Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

add-issue-comment

Add a comment to an existing GitHub issue by specifying the repository owner, repository name, issue number, and comment content.

Instructions

Add a comment to an existing issue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYes
issue_numberYes
ownerYes
repoYes

Implementation Reference

  • The core handler function for the 'add-issue-comment' tool. It validates input using AddIssueCommentSchema, uses the GitHub API to create a comment on the specified issue, and returns the created comment details.
    export async function addIssueComment(args: unknown): Promise<any> { const { owner, repo, issue_number, body } = AddIssueCommentSchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { const { data } = await github.getOctokit().issues.createComment({ owner, repo, issue_number, body, }); return { id: data.id, user: data.user ? { login: data.user.login, id: data.user.id, } : null, created_at: data.created_at, updated_at: data.updated_at, body: data.body, url: data.html_url, }; }, 'Failed to add issue comment'); }
  • Zod schema used for input validation in the addIssueComment handler. Extends OwnerRepoSchema with issue_number and body requirements.
    export const AddIssueCommentSchema = OwnerRepoSchema.extend({ issue_number: z.number().int().positive(), body: z.string().min(1, 'Comment body is required'), });
  • Switch case in the CallToolRequestSchema handler that dispatches to the addIssueComment function.
    case 'add-issue-comment': result = await addIssueComment(parsedArgs); break;
  • src/server.ts:669-691 (registration)
    Tool registration in the ListToolsRequestSchema response, including name, description, and input schema (mirrors the Zod schema).
    { name: 'add-issue-comment', description: 'Add a comment to an existing issue', inputSchema: { type: 'object', properties: { owner: { type: 'string', }, repo: { type: 'string', }, issue_number: { type: 'number', }, body: { type: 'string', }, }, required: ['owner', 'repo', 'issue_number', 'body'], additionalProperties: false, }, },
  • JSON Schema definition for the tool input, provided in the tool list response.
    inputSchema: { type: 'object', properties: { owner: { type: 'string', }, repo: { type: 'string', }, issue_number: { type: 'number', }, body: { type: 'string', }, }, required: ['owner', 'repo', 'issue_number', 'body'], additionalProperties: false, }, },

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/piyushgIITian/github-enterprice-mcp'

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