create_issue_comment
Add comments to GitHub issues to provide updates, ask questions, or share information within project workflows.
Instructions
Add a comment to a GitHub issue
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueNumber | Yes | ||
| body | Yes |
Implementation Reference
- The main handler function that executes the tool logic by calling the GitHub REST API to create a comment on the specified issue.async createIssueComment(data: { issueNumber: number; body: string; }): Promise<{ id: number; body: string; user: string; createdAt: string; updatedAt: string }> { try { const octokit = this.factory.getOctokit(); const config = this.factory.getConfig(); const response = await octokit.rest.issues.createComment({ owner: config.owner, repo: config.repo, issue_number: data.issueNumber, body: data.body }); return { id: response.data.id, body: response.data.body || '', user: response.data.user?.login || 'unknown', createdAt: response.data.created_at, updatedAt: response.data.updated_at }; } catch (error) { throw this.mapErrorToMCPError(error); } }
- Defines the tool schema, input validation using Zod, description, and usage examples for the create_issue_comment tool.export const createIssueCommentTool: ToolDefinition<CreateIssueCommentArgs> = { name: "create_issue_comment", description: "Add a comment to a GitHub issue", schema: createIssueCommentSchema as unknown as ToolSchema<CreateIssueCommentArgs>, examples: [ { name: "Add status update comment", description: "Post a comment to update the team on progress", args: { issueNumber: 42, body: "Working on this issue now. Should have a PR ready by EOD." } } ] };
- src/infrastructure/tools/ToolRegistry.ts:214-217 (registration)Registers the createIssueCommentTool (and related comment tools) in the central ToolRegistry during initialization.this.registerTool(createIssueCommentTool); this.registerTool(updateIssueCommentTool); this.registerTool(deleteIssueCommentTool); this.registerTool(listIssueCommentsTool);
- src/index.ts:320-321 (registration)MCP server request handler dispatches call_tool requests for 'create_issue_comment' to the ProjectManagementService implementation.case "create_issue_comment": return await this.service.createIssueComment(args);