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;

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