Skip to main content
Glama

list-issues

Retrieve and display issues from a GitHub repository by specifying owner, repo, state, and limit. Integrates with GitHub API via the MCP server for efficient issue management.

Instructions

List issues in a GitHub repository

Input Schema

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

Implementation Reference

  • The main handler function for the 'list-issues' tool. It uses Octokit to fetch issues from a GitHub repository based on owner, repo, state, and limit parameters, 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 schema definition including name, description, and inputSchema for validation, exposed via ListTools.
    "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:322-327 (registration)
    Registration of the tool handler in the toolHandlers object, which is imported and used by the MCP server's CallToolRequestSchema handler to dispatch calls by name.
    export const toolHandlers = { "search-repos": searchRepos, "get-repo-info": getRepoInfo, "list-issues": listIssues, "create-issue": createIssue, };
  • TypeScript type definition for the input arguments of the list-issues handler, matching the inputSchema.
    type ListIssuesArgs = { owner: string; repo: string; state?: "open" | "closed" | "all"; limit?: number; };

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/alsonwangkhem/github-mcp-2'

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