search_projects
Find GitLab projects by name to locate repositories for code review and analysis through the GitLab MCP Code Review server.
Instructions
Search for GitLab projects by name.
Args:
project_name: The name of the project to search for. If None, returns all projects.
Returns:
A list of projects matching the search criteria.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "search_projects"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:543-557 (handler)The handler function for the 'search_projects' tool, decorated with @mcp.tool() which registers it in the MCP server. It retrieves GitLab projects matching the given project_name (or all if None) using the GitLab client and returns them as a list of dictionaries.
@mcp.tool() def search_projects(ctx: Context, project_name: str = None) -> List[Dict[str, Any]]: """ Search for GitLab projects by name. Args: project_name: The name of the project to search for. If None, returns all projects. Returns: A list of projects matching the search criteria. """ gl = ctx.request_context.lifespan_context projects = gl.projects.list(search=project_name) return [p.asdict() for p in projects]