Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

search-issues

Search for issues and pull requests across GitHub repositories using the GitHub Enterprise MCP Server to find relevant content based on queries, sorting, and pagination parameters.

Instructions

Search for issues and pull requests across GitHub repositories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderNo
pageNo
per_pageNo
qYes
sortNo

Implementation Reference

  • The core handler function for the 'search-issues' tool. It validates input using SearchIssuesSchema, calls the GitHub API to search issues and pull requests, and returns formatted results.
    export async function searchIssues(args: unknown): Promise<any> {
      const { q, sort, order, page, per_page } = SearchIssuesSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().search.issuesAndPullRequests({
          q,
          sort: sort as any,
          order,
          page,
          per_page,
        });
    
        return {
          total_count: data.total_count,
          incomplete_results: data.incomplete_results,
          items: data.items.map((item) => ({
            id: item.id,
            number: item.number,
            title: item.title,
            state: item.state,
            locked: item.locked,
            repository: item.repository ? {
              name: item.repository.name,
              full_name: item.repository.full_name,
              owner: {
                login: item.repository.owner.login,
              },
            } : null,
            user: item.user ? {
              login: item.user.login,
              id: item.user.id,
            } : null,
            labels: item.labels?.map((label) => 
              typeof label === 'string' ? label : {
                name: label.name,
                color: label.color,
              }
            ),
            comments: item.comments,
            created_at: item.created_at,
            updated_at: item.updated_at,
            closed_at: item.closed_at,
            body: item.body,
            url: item.html_url,
            pull_request: item.pull_request ? {
              url: item.pull_request.html_url,
            } : null,
            score: item.score,
          })),
        };
      }, 'Failed to search issues');
    }
  • Zod schema used for input validation in the searchIssues handler.
    export const SearchIssuesSchema = z.object({
      q: z.string().min(1, 'Search query is required'),
      sort: z
        .enum([
          'comments',
          'reactions',
          'reactions-+1',
          'reactions--1',
          'reactions-smile',
          'reactions-thinking_face',
          'reactions-heart',
          'reactions-tada',
          'interactions',
          'created',
          'updated',
        ])
        .optional(),
      order: z.enum(['asc', 'desc']).optional(),
      page: z.number().min(1).optional(),
      per_page: z.number().min(1).max(100).optional(),
    });
  • Tool registration in the listTools handler, defining the name, description, and input schema for 'search-issues'.
    {
      name: 'search-issues',
      description: 'Search for issues and pull requests across GitHub repositories',
      inputSchema: {
        type: 'object',
        properties: {
          q: {
            type: 'string',
          },
          order: {
            type: 'string',
            enum: ['asc', 'desc'],
          },
          page: {
            type: 'number',
            minimum: 1,
          },
          per_page: {
            type: 'number',
            minimum: 1,
            maximum: 100,
          },
          sort: {
            type: 'string',
            enum: [
              'comments',
              'reactions',
              'reactions-+1',
              'reactions--1',
              'reactions-smile',
              'reactions-thinking_face',
              'reactions-heart',
              'reactions-tada',
              'interactions',
              'created',
              'updated',
            ],
          },
        },
        required: ['q'],
        additionalProperties: false,
      },
    },
  • Dispatch case in the callTool handler switch statement that routes 'search-issues' calls to the searchIssues function.
    case 'search-issues':
      result = await searchIssues(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 the full burden of behavioral disclosure. It mentions 'search' but doesn't describe key behaviors like pagination handling (implied by 'page' and 'per_page' parameters), rate limits, authentication requirements, or the format of search results. For a search tool with 5 parameters and no annotation coverage, this leaves significant gaps in understanding how the tool operates.

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?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action ('Search for issues and pull requests'), making it easy to parse. However, it could be more structured by including brief usage notes, but as-is, it avoids redundancy and waste.

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 tool's complexity (5 parameters, no output schema, and no annotations), the description is incomplete. It doesn't explain search behavior, result formatting, error handling, or how parameters interact (e.g., 'q' with 'sort'). For a search tool that likely returns paginated results, more context is needed to guide effective use, especially without annotations to fill in gaps.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It only mentions 'issues and pull requests' as search targets, which loosely relates to the 'q' parameter but doesn't explain its syntax (e.g., GitHub search query format) or the purpose of other parameters like 'order', 'sort', 'page', and 'per_page'. The description adds minimal value beyond the schema, failing to clarify parameter usage effectively.

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 tool's purpose as 'Search for issues and pull requests across GitHub repositories', which includes a specific verb ('Search') and resources ('issues and pull requests'). It distinguishes itself from siblings like 'list-issues' by indicating it searches across repositories rather than listing within a specific one. However, it doesn't explicitly differentiate from 'search-code' or 'search-repositories' in terms of search scope.

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 like 'list-issues', 'search-code', or 'get-issue'. It doesn't mention prerequisites, such as needing authentication or repository access, or specify use cases like cross-repository searches versus single-repository queries. Without such context, an agent might struggle to choose between this and sibling tools.

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