add_issue_comment
Add comments to GitHub issues to provide updates, answer questions, or track progress within repositories.
Instructions
Add a comment to an existing issue
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | ||
| repo | Yes | ||
| issue_number | Yes | ||
| body | Yes |
Implementation Reference
- operations/issues.ts:59-69 (handler)The core handler function that executes the GitHub API POST request to add a comment to the specified issue.export async function addIssueComment( owner: string, repo: string, issue_number: number, body: string ) { return githubRequest(`https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}/comments`, { method: "POST", body: { body }, }); }
- operations/issues.ts:10-15 (schema)Zod schema defining the input parameters (owner, repo, issue_number, body) for the add_issue_comment tool.export const IssueCommentSchema = z.object({ owner: z.string(), repo: z.string(), issue_number: z.number(), body: z.string(), });
- index.ts:133-137 (registration)Registration of the add_issue_comment tool in the MCP server's list of tools, specifying name, description, and input schema.{ name: "add_issue_comment", description: "Add a comment to an existing issue", inputSchema: zodToJsonSchema(issues.IssueCommentSchema) },
- index.ts:326-333 (registration)Dispatch/execution handler in the CallToolRequest switch statement that parses arguments and calls the addIssueComment function.case "add_issue_comment": { const args = issues.IssueCommentSchema.parse(request.params.arguments); const { owner, repo, issue_number, body } = args; const result = await issues.addIssueComment(owner, repo, issue_number, body); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }