Skip to main content
Glama

search_repositories

Find GitLab projects by searching with queries to locate repositories based on specific criteria, supporting pagination for result management.

Instructions

Search for GitLab projects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchYesSearch query
pageNoPage number for pagination (default: 1)
per_pageNoNumber of results per page (default: 20)

Implementation Reference

  • The tool handler in server.ts that receives the request and calls the api.searchProjects function.
    case "search_repositories": {
      const args = SearchRepositoriesSchema.parse(request.params.arguments);
      const results = await api.searchProjects(args.search, args.page, args.per_page);
      return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };
    }
  • The actual implementation of searching projects in the API layer.
    export async function searchProjects(query: string, page: number = 1, perPage: number = 20): Promise<GitLabSearchResponse> {
      if (!query?.trim()) {
        throw new Error("Search query is required");
      }
      if (page < 1) {
        throw new Error("Page number must be 1 or greater");
      }
      if (perPage < 1 || perPage > 100) {
        throw new Error("Per page must be between 1 and 100");
      }
    
      const params = buildSearchParams({
        search: query,
        page: page.toString(),
        per_page: perPage.toString()
      });
    
      const projects = await gitlabGet<GitLabRepository[]>("/projects", params);
    
      return GitLabSearchResponseSchema.parse({
        count: projects.length, // GitLab doesn't always provide total in headers
        items: projects
      });
    }
  • The schema definition for the search_repositories tool inputs.
    export const SearchRepositoriesSchema = z.object({
      search: z.string().describe("Search query"), // Changed from query to match GitLab API
      page: z.number().optional().describe("Page number for pagination (default: 1)"),
      per_page: z.number().optional().describe("Number of results per page (default: 20)")
    });
    
    export const SearchGroupsSchema = z.object({
      search: z.string().describe("Search query for groups"),
      page: z.number().optional().describe("Page number for pagination (default: 1)"),
  • src/server.ts:64-68 (registration)
    Tool registration in the server list_tools response.
    {
      name: "search_repositories",
      description: "Search for GitLab projects",
      inputSchema: zodToJsonSchema(SearchRepositoriesSchema)
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.5.2

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description does not disclose behavioral traits such as read-only nature, rate limits, or response format. It only states the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence is concise, but it lacks structure or front-loading of key information. It serves its purpose without excess.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple search tool with three parameters and no output schema, the description is minimally adequate. It does not explain return values or search behavior beyond the basic verb.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for all parameters. The description adds no additional meaning beyond the schema, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description says 'Search for GitLab projects' which is a specific verb and resource. It clearly distinguishes from sibling tools which are about creation, branching, and file operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. The description provides no context for when searching is appropriate compared to other actions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.