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
| Name | Required | Description | Default |
|---|---|---|---|
| issue_number | Yes | ||
| owner | Yes | ||
| repo | Yes |
Implementation Reference
- src/tools/issues.ts:78-130 (handler)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'); }
- src/utils/validation.ts:87-89 (schema)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, },
- src/server.ts:1212-1214 (registration)Dispatch registration in CallToolRequestHandler switch statement, calling the getIssue function.case 'get-issue': result = await getIssue(parsedArgs); break;