Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

get-issue

Retrieve detailed information about a specific GitHub repository issue by providing the repository owner, repository name, and issue number.

Instructions

Get details of a specific issue in a GitHub repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issue_numberYes
ownerYes
repoYes

Implementation Reference

  • The core handler function for the 'get-issue' tool. Validates input using GetIssueSchema, calls GitHub API to fetch the issue, maps the response to a simplified object, and wraps in error handling.
    export async function getIssue(args: unknown): Promise<any> {
      const { owner, repo, issue_number } = GetIssueSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().issues.get({
          owner,
          repo,
          issue_number,
        });
    
        return {
          id: data.id,
          number: data.number,
          title: data.title,
          state: data.state,
          locked: data.locked,
          assignees: data.assignees?.map((assignee) => ({
            login: assignee.login,
            id: assignee.id,
            type: assignee.type,
          })),
          user: data.user ? {
            login: data.user.login,
            id: data.user.id,
            type: data.user.type,
          } : null,
          labels: data.labels?.map((label) => 
            typeof label === 'string' ? label : {
              name: label.name,
              color: label.color,
              description: label.description,
            }
          ),
          milestone: data.milestone ? {
            id: data.milestone.id,
            number: data.milestone.number,
            title: data.milestone.title,
            description: data.milestone.description,
            state: data.milestone.state,
          } : null,
          comments: data.comments,
          created_at: data.created_at,
          updated_at: data.updated_at,
          closed_at: data.closed_at,
          body: data.body,
          url: data.html_url,
          pull_request: data.pull_request ? {
            url: data.pull_request.html_url,
          } : null,
        };
      }, 'Failed to get issue');
    }
  • Zod schema used for input validation in the getIssue handler. Extends OwnerRepoSchema with issue_number.
    export const GetIssueSchema = OwnerRepoSchema.extend({
      issue_number: z.number().int().positive(),
    });
  • src/server.ts:567-584 (registration)
    Tool registration in ListToolsRequestHandler, including name, description, and input schema matching GetIssueSchema.
    name: 'get-issue',
    description: 'Get details of a specific issue in a GitHub repository.',
    inputSchema: {
      type: 'object',
      properties: {
        owner: {
          type: 'string',
        },
        repo: {
          type: 'string',
        },
        issue_number: {
          type: 'number',
        },
      },
      required: ['owner', 'repo', 'issue_number'],
      additionalProperties: false,
    },
  • Dispatch registration in CallToolRequestHandler switch statement, calling the getIssue function.
    case 'get-issue':
      result = await getIssue(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