Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

search-repositories

Find GitHub repositories using search queries with GitHub's search syntax to locate specific codebases, projects, or organizations based on criteria like name, description, language, or topic.

Instructions

Search for GitHub repositories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination (default: 1)
perPageNoNumber of results per page (default: 30, max: 100)
queryYesSearch query (see GitHub search syntax)

Implementation Reference

  • The main handler function for 'search-repositories' tool. Validates input using SearchRepositoriesSchema, calls GitHub's search.repos API, maps and returns the results.
    export async function searchRepositories(args: unknown): Promise<any> {
      const { query, page, perPage } = SearchRepositoriesSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().search.repos({
          q: query,
          page,
          per_page: perPage,
        });
    
        return {
          total_count: data.total_count,
          incomplete_results: data.incomplete_results,
          items: data.items.map((repo) => ({
            id: repo.id,
            name: repo.name,
            full_name: repo.full_name,
            owner: repo.owner ? {
              login: repo.owner.login,
              id: repo.owner.id,
              type: repo.owner.type,
            } : null,
            private: repo.private,
            description: repo.description,
            fork: repo.fork,
            created_at: repo.created_at,
            updated_at: repo.updated_at,
            pushed_at: repo.pushed_at,
            homepage: repo.homepage,
            size: repo.size,
            stargazers_count: repo.stargazers_count,
            watchers_count: repo.watchers_count,
            language: repo.language,
            forks_count: repo.forks_count,
            open_issues_count: repo.open_issues_count,
            default_branch: repo.default_branch,
            url: repo.html_url,
          })),
        };
      }, 'Failed to search repositories');
    }
  • Zod schema defining the input parameters for the search-repositories tool, used for validation in the handler.
    export const SearchRepositoriesSchema = z.object({
      query: z.string().min(1, 'Search query is required'),
      page: z.number().optional(),
      perPage: z.number().min(1).max(100).optional(),
    });
  • src/server.ts:102-124 (registration)
    Tool registration in the server's listTools handler, defining name, description, and input schema.
    {
      name: 'search-repositories',
      description: 'Search for GitHub repositories',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query (see GitHub search syntax)',
          },
          page: {
            type: 'number',
            description: 'Page number for pagination (default: 1)',
          },
          perPage: {
            type: 'number',
            description: 'Number of results per page (default: 30, max: 100)',
          },
        },
        required: ['query'],
        additionalProperties: false,
      },
    },
  • Dispatch case in the server's CallToolRequest handler that invokes the searchRepositories function.
    case 'search-repositories':
      result = await searchRepositories(parsedArgs);
      break;
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Search for GitHub repositories' implies a read-only operation but doesn't mention authentication requirements, rate limits, pagination behavior beyond what's in the schema, or what the output format looks like. For a search tool with no annotation coverage, this leaves significant gaps in understanding how it behaves.

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 states the core purpose without unnecessary words. It's appropriately sized for a search tool and front-loads the essential information.

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?

For a search tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the search results contain, how they're structured, or any behavioral aspects like authentication needs or rate limits. The 100% schema coverage helps with parameters, but overall context for proper tool usage is lacking.

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%, so the schema already documents all three parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. The baseline score of 3 is appropriate when the schema does all the parameter documentation work.

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 clearly states the action ('Search for') and resource ('GitHub repositories'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search-code', 'search-issues', or 'search-users', which all search GitHub but target different resources.

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. With multiple search tools available (search-code, search-issues, search-users), there's no indication that this is specifically for repository searches versus other GitHub entities. No context about prerequisites or limitations is mentioned.

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/piyushgIITian/github-enterprice-mcp'

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