add_issue_comment
Add comments to GitHub issues to provide updates, answer questions, or track progress. Specify repository owner, repository name, issue number, and comment content.
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
- src/operations/issues.ts:79-90 (handler)The core handler function that executes the tool by posting a comment to the specified GitHub issue using the GitHub REST API.export async function addIssueComment( github_pat: string, owner: string, repo: string, issue_number: number, body: string ) { return githubRequest(github_pat, `https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}/comments`, { method: "POST", body: { body }, }); }
- src/operations/issues.ts:14-23 (schema)Zod schemas defining the input parameters for the tool, including the public schema used in registration and the internal one with github_pat.export const IssueCommentSchema = z.object({ owner: z.string(), repo: z.string(), issue_number: z.number(), body: z.string(), }); export const _IssueCommentSchema = IssueCommentSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/index.ts:138-142 (registration)Tool registration 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) },
- src/index.ts:500-507 (registration)Dispatch handler in the MCP server's CallToolRequest that parses arguments and calls the issues.addIssueComment function.case "add_issue_comment": { const argsWithPat = issues._IssueCommentSchema.parse(params.arguments); const { github_pat, owner, repo, issue_number, body } = argsWithPat; const result = await issues.addIssueComment(github_pat, owner, repo, issue_number, body); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }