Skip to main content
Glama
flyanima

Open Search MCP

by flyanima

search_gitlab

Search GitLab projects and repositories using queries to find relevant codebases and development resources.

Instructions

Search GitLab projects and repositories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for GitLab repositories
maxResultsNoMaximum number of results to return

Implementation Reference

  • The execute handler function that performs the core logic of the search_gitlab tool, simulating GitLab repository search with fake results.
    execute: async (args: ToolInput): Promise<ToolOutput> => {
      try {
        const { query, maxResults = 20 } = args;
        
        // Simulated GitLab search results
        const results = Array.from({ length: Math.min(maxResults, 10) }, (_, i) => ({
          name: `${query}-project-${i + 1}`,
          description: `A GitLab project related to ${query}`,
          url: `https://gitlab.com/user${i + 1}/${query}-project-${i + 1}`,
          stars: Math.floor(Math.random() * 1000),
          forks: Math.floor(Math.random() * 100),
          language: ['JavaScript', 'Python', 'Go', 'Rust', 'Java'][i % 5],
          lastActivity: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
          visibility: i % 3 === 0 ? 'private' : 'public',
          namespace: `user${i + 1}`,
          topics: [query, 'gitlab', 'open-source']
        }));
    
        return {
          success: true,
          data: {
            source: 'GitLab',
            query,
            results,
            totalResults: results.length
          },
          metadata: {
            searchTime: Date.now(),
            source: 'GitLab API'
          }
        };
      } catch (error) {
        return {
          success: false,
          error: `GitLab search failed: ${error instanceof Error ? error.message : String(error)}`,
          data: null
        };
      }
    }
  • The registry.registerTool call that defines and registers the search_gitlab tool including its schema, description, and inline handler.
    registry.registerTool({
      name: 'search_gitlab',
      description: 'Search GitLab projects and repositories',
      category: 'developer',
      source: 'GitLab',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query for GitLab repositories'
          },
          maxResults: {
            type: 'number',
            description: 'Maximum number of results to return',
            default: 20,
            minimum: 1,
            maximum: 100
          }
        },
        required: ['query']
      },
      execute: async (args: ToolInput): Promise<ToolOutput> => {
        try {
          const { query, maxResults = 20 } = args;
          
          // Simulated GitLab search results
          const results = Array.from({ length: Math.min(maxResults, 10) }, (_, i) => ({
            name: `${query}-project-${i + 1}`,
            description: `A GitLab project related to ${query}`,
            url: `https://gitlab.com/user${i + 1}/${query}-project-${i + 1}`,
            stars: Math.floor(Math.random() * 1000),
            forks: Math.floor(Math.random() * 100),
            language: ['JavaScript', 'Python', 'Go', 'Rust', 'Java'][i % 5],
            lastActivity: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
            visibility: i % 3 === 0 ? 'private' : 'public',
            namespace: `user${i + 1}`,
            topics: [query, 'gitlab', 'open-source']
          }));
    
          return {
            success: true,
            data: {
              source: 'GitLab',
              query,
              results,
              totalResults: results.length
            },
            metadata: {
              searchTime: Date.now(),
              source: 'GitLab API'
            }
          };
        } catch (error) {
          return {
            success: false,
            error: `GitLab search failed: ${error instanceof Error ? error.message : String(error)}`,
            data: null
          };
        }
      }
    });
  • src/index.ts:238-238 (registration)
    Invocation of the registerGitLabBitbucketTools function during MCP server initialization, which registers the search_gitlab tool.
    registerGitLabBitbucketTools(this.toolRegistry);    // 2 tools: search_gitlab, search_bitbucket
  • Additional input validation schema reference for search_gitlab using the basicSearch Zod schema.
    'search_gitlab': ToolSchemas.basicSearch,
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Search') but doesn't describe what the search returns (e.g., project metadata, repository details), authentication requirements, rate limits, pagination behavior, or error handling. For a search tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with zero wasted content, making it easy for an agent to parse quickly.

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

Completeness2/5

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

Given the complexity of a search operation, lack of annotations, and no output schema, the description is insufficient. It doesn't explain what the search returns (e.g., list of projects with fields like name, URL, stars), how results are ordered, or any limitations. For a tool with 2 parameters and no structured output definition, more context is needed.

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 description coverage is 100%, with both parameters ('query' and 'maxResults') well-documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the structured schema, so it meets the baseline of 3 for adequate coverage without extra value.

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

Purpose4/5

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

The description 'Search GitLab projects and repositories' clearly states the verb ('Search') and resource ('GitLab projects and repositories'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search_bitbucket' or 'search_github' (if present), which would require more specific scope definition to earn a 5.

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?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of context, prerequisites, or comparison with sibling tools like 'search_bitbucket' or 'search_github' (implied by context). The agent must infer usage purely from the tool name and description.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/flyanima/open-search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server