get_issue_task
Fetch and utilize GitHub issue details as tasks by providing the issue URL, enabling efficient task management and integration with GitHub’s platform.
Instructions
Fetch GitHub issue details to use as a task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | GitHub issue URL (https://github.com/owner/repo/issues/number) |
Implementation Reference
- src/index.ts:128-174 (handler)The MCP CallTool request handler specifically for the 'get_issue_task' tool. It validates the tool name, extracts the URL parameter, fetches issue details using getIssueDetails, formats the response as a JSON task object, and handles errors.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { if (request.params.name !== "get_issue_task") { throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`, ); } const { url } = request.params.arguments as { url: string }; if (!url) { throw new McpError( ErrorCode.InvalidParams, "URL parameter is required", ); } try { const issue = await this.getIssueDetails(url); return { content: [ { type: "text", text: JSON.stringify( { task: { title: issue.title, description: issue.body, source: issue.url, }, }, null, 2, ), }, ], }; } catch (error) { if (error instanceof McpError) { throw error; } throw new McpError( ErrorCode.InternalError, `Unexpected error: ${error}`, ); } }); }
- src/index.ts:81-105 (helper)Helper function that parses the GitHub issue URL and fetches the issue details (title, body, URL) using the Octokit client.private async getIssueDetails(url: string): Promise<IssueDetails> { const { owner, repo, issue_number } = this.parseGitHubUrl(url); try { const response = await this.octokit.issues.get({ owner, repo, issue_number, }); return { title: response.data.title, body: response.data.body || "", url: response.data.html_url, }; } catch (error) { if (error instanceof Error) { throw new McpError( ErrorCode.InternalError, `GitHub API error: ${error.message}`, ); } throw error; } }
- src/index.ts:62-79 (helper)Helper function to parse GitHub issue URL into owner, repo, and issue number components.private parseGitHubUrl(url: string): { owner: string; repo: string; issue_number: number; } { const match = url.match(/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/); if (!match) { throw new McpError( ErrorCode.InvalidParams, "Invalid GitHub issue URL format. Expected: https://github.com/owner/repo/issues/number", ); } return { owner: match[1], repo: match[2], issue_number: parseInt(match[3], 10), }; }
- src/index.ts:110-126 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: "get_issue_task", description: "Fetch GitHub issue details to use as a task", inputSchema: { type: "object", properties: { url: { type: "string", description: "GitHub issue URL (https://github.com/owner/repo/issues/number)", }, }, required: ["url"], }, }, ], }));
- src/index.ts:113-123 (schema)Input schema definition for the get_issue_task tool, requiring a 'url' parameter.inputSchema: { type: "object", properties: { url: { type: "string", description: "GitHub issue URL (https://github.com/owner/repo/issues/number)", }, }, required: ["url"], },