Skip to main content
Glama
sammcj

MCP GitHub Issue Server

by sammcj

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
NameRequiredDescriptionDefault
urlYesGitHub issue URL (https://github.com/owner/repo/issues/number)

Implementation Reference

  • 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}`, ); } }); }
  • 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; } }
  • 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"], }, }, ], }));
  • 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"], },

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/sammcj/mcp-github-issue'

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