Skip to main content
Glama
alsonwangkhem

GitHub MCP Server

list-issues

Retrieve issues from a GitHub repository by specifying owner, repository name, state (open/closed/all), and optional limit to manage and track project tasks.

Instructions

List issues in a GitHub repository

Input Schema

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

Implementation Reference

  • The main handler function that executes the list-issues tool logic, fetching issues from a GitHub repository using the Octokit client and returning formatted JSON.
    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}`,
            },
          ],
        };
      }
    };
  • Input schema definition for the list-issues tool, specifying parameters like owner, repo, state, and limit.
    "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)
    Export of the toolHandlers mapping that associates the 'list-issues' name with its handler function listIssues.
    export const toolHandlers = {
      "search-repos": searchRepos,
      "get-repo-info": getRepoInfo,
      "list-issues": listIssues,
      "create-issue": createIssue,
    };
  • src/handlers.ts:22-31 (registration)
    MCP server handler for CallToolRequestSchema that dynamically invokes the tool handler based on the tool name 'list-issues' from toolHandlers.
    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);
    })
  • src/handlers.ts:19-21 (registration)
    MCP server handler for ListToolsRequestSchema that lists all available tools including the schema for 'list-issues'.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: Object.values(tools)
    }));
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('List issues') but doesn't mention critical behaviors like whether this is a read-only operation, if it requires authentication, rate limits, pagination details, or what the output format looks like. This leaves significant gaps for an agent to understand how to use it effectively.

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, clear sentence with no wasted words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse.

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 complexity of a GitHub API tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like authentication needs, rate limits, or output structure, which are crucial for an agent to invoke this tool correctly in a real-world context.

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?

The schema description coverage is 100%, meaning all parameters are documented in the input schema. The description adds no additional meaning beyond what's already in the schema (e.g., it doesn't explain parameter interactions or provide examples). This meets the baseline for high schema coverage.

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 verb ('List') and resource ('issues in a GitHub repository'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search-repos' or 'get-repo-info', which might also involve repository data retrieval, so it doesn't reach the highest score.

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 'search-repos' or 'create-issue'. It lacks any context about prerequisites, such as needing repository access, or when this tool is preferred over others for issue retrieval.

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

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