search_projects
Find GitLab projects by name to identify repositories for code review, analysis, and merge request management.
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_name | No |
Input Schema (JSON Schema)
{
"properties": {
"project_name": {
"default": null,
"title": "Project Name",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- server.py:395-410 (handler)The main handler function for the 'search_projects' tool. It is decorated with @mcp.tool(), which registers it with the MCP server. The function retrieves the GitLab client from context, searches for projects by name (or lists all if None), and returns their details as 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]
- server.py:395-395 (registration)The @mcp.tool() decorator registers the search_projects function as an MCP tool.@mcp.tool()