Skip to main content
Glama

add_issue_comment

Add a comment to a GitHub issue by specifying owner, repo, issue number, and comment body.

Instructions

Add a comment to a specific issue in a GitHub repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner
repoYesRepository name
issue_numberYesIssue number to comment on
bodyYesComment content

Implementation Reference

  • The handler function for the 'add_issue_comment' MCP tool. Calls `octokit.rest.issues.createComment` to add a comment to a GitHub issue. Takes owner, repo, issue_number, and body as input, and returns the comment URL and ID on success.
    // Tool: Add Issue Comment
    server.tool(
    	"add_issue_comment",
    	"Add a comment to a specific issue in a GitHub repository.",
    	{
    		owner: z.string().describe("Repository owner"),
    		repo: z.string().describe("Repository name"),
    		issue_number: z.number().describe("Issue number to comment on"),
    		body: z.string().describe("Comment content"),
    	},
    	async ({ owner, repo, issue_number, body }) => {
    		try {
    			const response = await octokit.rest.issues.createComment({
    				owner,
    				repo,
    				issue_number,
    				body,
    			})
    			const c = response.data
    			return {
    				content: [{ type: "text", text: `Comment added to #${issue_number}\nURL: ${c.html_url}\nID: ${c.id}` }],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
  • Input schema for 'add_issue_comment' defining required parameters: owner (string), repo (string), issue_number (number), and body (string), each with Zod validation and descriptions.
    {
    	owner: z.string().describe("Repository owner"),
    	repo: z.string().describe("Repository name"),
    	issue_number: z.number().describe("Issue number to comment on"),
    	body: z.string().describe("Comment content"),
    },
  • Registration of the tool via `server.tool("add_issue_comment", ...)` within the `registerIssueTools` function.
    server.tool(
    	"add_issue_comment",
    	"Add a comment to a specific issue in a GitHub repository.",
    	{
    		owner: z.string().describe("Repository owner"),
    		repo: z.string().describe("Repository name"),
    		issue_number: z.number().describe("Issue number to comment on"),
    		body: z.string().describe("Comment content"),
    	},
    	async ({ owner, repo, issue_number, body }) => {
    		try {
    			const response = await octokit.rest.issues.createComment({
    				owner,
    				repo,
    				issue_number,
    				body,
    			})
    			const c = response.data
    			return {
    				content: [{ type: "text", text: `Comment added to #${issue_number}\nURL: ${c.html_url}\nID: ${c.id}` }],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
  • src/index.ts:14-16 (registration)
    The `registerAllToolsAndResources` function calls `registerIssueTools(server, octokit)` which registers all issue tools including 'add_issue_comment'.
    export function registerAllToolsAndResources(server: McpServer, octokit: Octokit): void {
    	registerSearchTools(server, octokit)
    	registerIssueTools(server, octokit)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavior. It only states a write operation without mentioning side effects, authentication needs, or rate limits. The verb 'add' implies mutation but lacks detail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single 12-word sentence, concise and front-loaded. Every word is necessary to convey the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Missing output schema and behavioral context (like idempotency, return value). The tool is simple but lacks completeness without annotations or any extra details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for all parameters. The description does not add meaning beyond the schema, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'add' and resource 'comment to a specific issue in a GitHub repository', distinguishing it from sibling tools like create_issue or get_issue_comments.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives (e.g., using pull request review comments for PRs). The description lacks context about prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hithereiamaliff/mcp-github'

If you have feedback or need assistance with the MCP directory API, please join our Discord server