add_issue_comment
Add a comment to a GitHub issue by specifying the repository owner, repository name, issue number, and comment body. Facilitates issue tracking and collaboration directly within the platform.
Instructions
Add a comment to an existing issue
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | ||
| issue_number | Yes | ||
| owner | Yes | ||
| repo | Yes |
Implementation Reference
- operations/issues.ts:67-77 (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:11-16 (schema)Zod schema defining the input parameters for the add_issue_comment tool: owner, repo, issue_number, and body.export const IssueCommentSchema = z.object({ owner: z.string(), repo: z.string(), issue_number: z.number(), body: z.string(), });
- index.ts:130-134 (registration)Tool registration in the list of tools returned by ListToolsRequest, including name, description, and input schema.{ name: "add_issue_comment", description: "Add a comment to an existing issue", inputSchema: zodToJsonSchema(issues.IssueCommentSchema) },
- index.ts:459-466 (registration)Dispatch handler in the CallToolRequestSchema switch statement that validates input 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) }], }; }