Skip to main content
Glama

list-issues

Retrieve and display GitHub repository issues by specifying owner, repo, state, and limit. Streamlines issue tracking and management using the GitHub MCP Server.

Instructions

List issues in a GitHub repository

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of issues to return
ownerYesRepository owner (username or organization)
repoYesRepository name
stateNoIssue state

Input Schema (JSON Schema)

{ "properties": { "limit": { "description": "Maximum number of issues to return", "type": "number" }, "owner": { "description": "Repository owner (username or organization)", "type": "string" }, "repo": { "description": "Repository name", "type": "string" }, "state": { "description": "Issue state", "enum": [ "open", "closed", "all" ], "type": "string" } }, "required": [ "owner", "repo" ], "type": "object" }

Implementation Reference

  • The main handler function for the 'list-issues' tool. It extracts parameters, calls the GitHub API via Octokit to list issues in the specified repository, formats the response as JSON, and handles errors.
    const listIssues = async (args: ListIssuesArgs) => { const { owner, repo, state = "open", limit = 10 } = args; try { const response = await octokit.rest.issues.listForRepo({ owner, repo, state, per_page: limit, }); return { content: [ { type: "text", text: JSON.stringify( response.data.map(issue => ({ number: issue.number, title: issue.title, state: issue.state, created_at: issue.created_at, updated_at: issue.updated_at, user: issue.user?.login, labels: issue.labels.map(label => typeof label === 'string' ? label : label.name ), url: issue.html_url, comments: issue.comments, })), null, 2 ), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: "text", text: `Error listing issues: ${errorMessage}`, }, ], }; } };
  • The tool definition including name, description, and inputSchema used for tool listing and validation in MCP.
    "list-issues": { name: "list-issues", description: "List issues in a GitHub repository", inputSchema: { type: "object", properties: { owner: { type: "string", description: "Repository owner (username or organization)", }, repo: { type: "string", description: "Repository name", }, state: { type: "string", enum: ["open", "closed", "all"], description: "Issue state", }, limit: { type: "number", description: "Maximum number of issues to return", } }, required: ["owner", "repo"], }, },
  • src/tools.ts:325-325 (registration)
    Maps the tool name 'list-issues' to its handler function listIssues in the toolHandlers object, used by the generic CallToolRequestSchema handler.
    "list-issues": listIssues,
  • TypeScript type definition for the arguments accepted by the listIssues handler, matching the inputSchema.
    type ListIssuesArgs = { owner: string; repo: string; state?: "open" | "closed" | "all"; limit?: number; };
  • src/handlers.ts:19-21 (registration)
    Registers the ListToolsRequestSchema handler, which returns all tools including 'list-issues' schema via Object.values(tools).
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools) }));
  • src/handlers.ts:22-32 (registration)
    Registers the generic CallToolRequestSchema handler that dispatches to the specific tool handler (listIssues for 'list-issues') based on name.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { type ToolHandlerKey = keyof typeof toolHandlers; const { name, arguments: params } = request.params ?? {}; const handler = toolHandlers[name as ToolHandlerKey]; if (!handler) throw new Error("tool not found"); type HandlerParams = Parameters<typeof handler>; return handler(params as any); }) }

Other Tools

Related 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/ualUsham/mcp-github'

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