# Search

Search GitLab across the instance, a group or a project for code, merge requests, issues, commits, milestones, notes, projects, snippets, users and wiki pages.

Source: https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/
Updated: 2026-11-22

---

Full-text search, one action per kind of result: code, merge requests, issues, commits, milestones, notes, projects, snippets, users and wiki pages. Each searches a project or a group when given one, and the whole instance otherwise. `search_type` asks for a search backend, `basic`, `advanced` or `zoekt`, and GitLab refuses one the instance has not enabled. Every action only reads.

## Sample questions

- "Search the code of group platform for parseConfig"
- "Find merge requests that mention the login bug"
- "Which issues mention timeout in project 42?"

## How to call it

- **Dynamic**, the default surface: call `gitlab_execute_action` with `action` set to the action's ID, such as `search.code`, and its parameters in `params`. `gitlab_find_action` finds an ID from a description of the task.
- **Meta** (`GITLAB_MCP_TOOL_SURFACE=meta`): call `gitlab_search` with `action` set to the action's name, such as `code`, and its parameters in `params`.
- **Individual** (`GITLAB_MCP_TOOL_SURFACE=individual`): call the action's own tool, such as `gitlab_search_code`, with its parameters as the arguments.

## Availability

Every tier serves the whole group, on self-managed instances and on GitLab.com alike.

Read-only actions: 10 of 10, the ones a deployment in read-only mode keeps. A token with `read_api` and not `api` is served 10 of the 10.

## Actions

The description of each action, and of each of its parameters, is the text the server serves for it on the default surface, quoted as served. The token lines say what GitLab 19.6.1 requires of a token for the requests each action sends; on an instance with Admin Mode turned on, an action only an administrator may run also needs `admin_mode`.

| Action | Individual |
| --- | --- |
| [`search.code`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchcode) | `gitlab_search_code` |
| [`search.commits`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchcommits) | `gitlab_search_commits` |
| [`search.issues`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchissues) | `gitlab_search_issues` |
| [`search.merge_requests`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchmerge_requests) | `gitlab_search_merge_requests` |
| [`search.milestones`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchmilestones) | `gitlab_search_milestones` |
| [`search.notes`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchnotes) | `gitlab_search_notes` |
| [`search.projects`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchprojects) | `gitlab_search_projects` |
| [`search.snippets`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchsnippets) | `gitlab_search_snippets` |
| [`search.users`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchusers) | `gitlab_search_users` |
| [`search.wiki`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchwiki) | `gitlab_search_wiki` |

### `search.code`

> Search code blobs across global, group, or project scope. Returns: matching blobs with file path, basename, ref, the line the snippet starts on, the snippet, project ID, and pagination metadata. On basic search a file that matched by its path also carries its blob ID, and its snippet is the start of the file rather than the lines around a match. On exact search such a file carries its path in place of a snippet. num_context_lines (0 to 20) sets the lines around each match on advanced and exact search, and regex chooses between a regular expression and literal text on exact search. See also: [`search.projects`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchprojects), [`repository.file_get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/repository/#repositoryfile_get), [`repository.tree`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/repository/#repositorytree).

- **Meta-tool**: `gitlab_search`, action `code`
- **Individual tool**: `gitlab_search_code`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: one of: Global Search: Use at project **or** Global Search: Use at group **or** Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query text (param 'query' not 'search') |
| `group_id` | `string` | no | Group ID or URL-encoded path (optional) |
| `num_context_lines` | `integer` | no | Lines of context GitLab sends around a code match, up to this many on each side, 0 to 20. Honored by advanced and exact code search (search_type advanced or zoekt), which send 2 and 1 by default, though exact search only from GitLab 19.5. GitLab Enterprise 18.11 and later refuses it on basic search, which a project search of a ref other than the default branch always runs, unless the token carries the mcp scope. Earlier releases and Community Edition ignore it |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `project_id` | `string` | no | Project ID or URL-encoded path (optional) |
| `ref` | `string` | no | Branch or tag name to search in (default: default branch) |
| `regex` | `boolean` | no | Search the query as a regular expression (true) or as literal text (false). Honored by exact code search alone (search_type zoekt), which reads the query as a regular expression when this is left out. GitLab Enterprise 18.9 and later refuses it on any other backend, false included, and so on a project search of a ref other than the default branch, which always runs basic search, unless the token carries the mcp scope. Earlier releases and Community Edition ignore it |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.commits`

> Search commit messages across global, group, or project scope. Returns: matching commits with short and full SHA, title, message, author, and committed date plus pagination metadata. See also: [`search.code`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchcode), [`repository.commit_get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/repository/#repositorycommit_get), [`repository.file_history`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/repository/#repositoryfile_history).

- **Meta-tool**: `gitlab_search`, action `commits`
- **Individual tool**: `gitlab_search_commits`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: one of: Global Search: Use at project **or** Global Search: Use at group **or** Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query string |
| `group_id` | `string` | no | Group ID or URL-encoded path (optional) |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `project_id` | `string` | no | Project ID or URL-encoded path (optional) |
| `ref` | `string` | no | Branch or tag whose commits a project search reads (default: the default branch). Group and instance searches do not take it |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.issues`

> Search issues across global, group, or project scope. Returns: matching issues with title, state, labels, assignees, author, and web URL plus pagination metadata. See also: [`search.merge_requests`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchmerge_requests), [`issue.list`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/issue/#issuelist), [`issue.get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/issue/#issueget).

- **Meta-tool**: `gitlab_search`, action `issues`
- **Individual tool**: `gitlab_search_issues`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: one of: Global Search: Use at project **or** Global Search: Use at group **or** Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query text (param 'query' not 'search') |
| `group_id` | `string` | no | Group ID or URL-encoded path (optional) |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `project_id` | `string` | no | Project ID or URL-encoded path (optional) |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.merge_requests`

> Search merge requests across global, group, or project scope. Returns: matching merge requests with title, state, author, source and target branches, and web URL plus pagination metadata. See also: [`search.issues`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchissues), [`merge_request.list`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/merge-request/#merge_requestlist), [`merge_request.get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/merge-request/#merge_requestget).

- **Meta-tool**: `gitlab_search`, action `merge_requests`
- **Individual tool**: `gitlab_search_merge_requests`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: one of: Global Search: Use at project **or** Global Search: Use at group **or** Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query text (param 'query' not 'search') |
| `group_id` | `string` | no | Group ID or URL-encoded path (optional) |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `project_id` | `string` | no | Project ID or URL-encoded path (optional) |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.milestones`

> Search milestones across global, group, or project scope. Returns: matching milestones with title, description, state, start and due dates, and web URL plus pagination metadata. See also: [`project.milestone_list`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/project/#projectmilestone_list), [`project.milestone_get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/project/#projectmilestone_get), [`search.issues`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchissues).

- **Meta-tool**: `gitlab_search`, action `milestones`
- **Individual tool**: `gitlab_search_milestones`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: one of: Global Search: Use at project **or** Global Search: Use at group **or** Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query string |
| `group_id` | `string` | no | Group ID or URL-encoded path (optional) |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `project_id` | `string` | no | Project ID or URL-encoded path (optional) |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.notes`

> Search note bodies within one project. Returns: matching notes with body, author, noteable type and ID, system and internal flags, and timestamps plus pagination metadata. See also: [`search.issues`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchissues), [`search.merge_requests`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchmerge_requests), [`issue.note_list`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/issue/#issuenote_list).

- **Meta-tool**: `gitlab_search`, action `notes`
- **Individual tool**: `gitlab_search_notes`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: Global Search: Use at project ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `project_id` | `string` | yes | Project ID or URL-encoded path |
| `query` | `string` | yes | Search query string |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.projects`

> Search projects globally or within a group by name, path, or description. Returns: matching projects with namespace, visibility, default branch, and web URL plus pagination metadata. See also: [`project.get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/project/#projectget), [`project.list`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/project/#projectlist), [`search.code`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchcode).

- **Meta-tool**: `gitlab_search`, action `projects`
- **Individual tool**: `gitlab_search_projects`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: one of: Global Search: Use at group **or** Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query string |
| `group_id` | `string` | no | Group ID or URL-encoded path. Omit for a global search |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.snippets`

> Search snippet titles globally. Returns: matching snippets with title, file name, description, visibility, author, project ID, web and raw URLs, and timestamps plus pagination metadata. See also: [`search.code`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchcode), [`search.projects`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchprojects).

- **Meta-tool**: `gitlab_search`, action `snippets`
- **Individual tool**: `gitlab_search_snippets`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query string |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.users`

> Search users across global, group, or project scope. Returns: matching users with ID, username, name, state, avatar URL, and web URL plus pagination metadata. See also: [`user.get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/user/#userget), [`user.list`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/user/#userlist), [`project.members`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/project/#projectmembers).

- **Meta-tool**: `gitlab_search`, action `users`
- **Individual tool**: `gitlab_search_users`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: one of: Global Search: Use at project **or** Global Search: Use at group **or** Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query string |
| `group_id` | `string` | no | Group ID or URL-encoded path (optional) |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `project_id` | `string` | no | Project ID or URL-encoded path (optional) |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |

### `search.wiki`

> Search wiki blobs across global, group, or project scope. Returns: the file of each matching wiki page with its path (the page slug plus the format's extension), ref, the line the snippet starts on, the snippet, its project ID and, from advanced search, its group ID (a page of a group wiki carries the group alone), and pagination metadata. On basic search a page whose file matched by its path also carries its blob ID, and its snippet is the start of the page. See also: [`search.code`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/search/#searchcode), [`wiki.list`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/wiki/#wikilist), [`wiki.get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/wiki/#wikiget), [`group.wiki_get`](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/group/#groupwiki_get).

- **Meta-tool**: `gitlab_search`, action `wiki`
- **Individual tool**: `gitlab_search_wiki`
- **Tier**: Free
- **Classic or OAuth token**: `read_api` (or `api`)
- **Fine-grained token**: one of: Global Search: Use at project **or** Global Search: Use at group **or** Global Search: Use at user ([permissions page](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/#search))
- **Behavior**: read-only, idempotent

| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| `query` | `string` | yes | Search query string |
| `group_id` | `string` | no | Group ID or URL-encoded path (optional) |
| `page` | `integer` | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
| `per_page` | `integer` | no | Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large. |
| `project_id` | `string` | no | Project ID or URL-encoded path (optional) |
| `ref` | `string` | no | Branch or tag of the wiki repository a project search reads (default: the default branch). Group and instance searches do not take it |
| `search_type` | `string` (`basic`, `advanced`, `zoekt`) | no | Search backend to request. Use 'basic' for GitLab's default search, 'advanced' for Elasticsearch/OpenSearch-backed search, or 'zoekt' for Zoekt-based search. The requested backend must be enabled on the GitLab instance. |
