add_issue_comment
Add detailed comments to GitHub issues using owner, repo, issue number, and body inputs. Facilitates issue tracking and collaboration within projects.
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
- src/operations/issues.ts:79-90 (handler)Core handler function that executes the GitHub API POST request to add a comment to an issue.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 (IssueCommentSchema) and extended with PAT (_IssueCommentSchema) for the add_issue_comment tool.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 entry in the listTools response, 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 (handler)Dispatch handler in the main CallToolRequestSchema that validates arguments and calls the specific 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) }], }; }