Skip to main content
Glama
Sunwood-ai-labs

GitHub Kanban MCP Server

add_comment

Enables users to add comments to GitHub issues within a Kanban board, supporting Markdown formatting and optional issue state updates for streamlined task management.

Instructions

タスクにコメントを追加

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesコメントの内容(Markdown形式対応)
issue_numberYesタスク(Issue)のID
repoYesGitHubリポジトリ名
stateNoコメント時に変更するissueの状態(オプション)

Implementation Reference

  • The main handler function that executes the add_comment tool logic: adds a comment to a GitHub issue using gh CLI, optionally changes issue state, and returns updated issue info.
    export async function handleAddComment(args: { repo: string; issue_number: string; body: string; state?: 'open' | 'closed'; }): Promise<ToolResponse> { const tempFile = 'comment_body.md'; try { // ステータスの変更が指定されている場合は先に処理 if (args.state) { try { const command = args.state === 'closed' ? 'close' : 'reopen'; await execAsync( `gh issue ${command} ${args.issue_number} --repo ${args.repo}` ); console.log(`Issue status changed to ${args.state}`); } catch (error) { console.error('Failed to change issue status:', error); throw new McpError( ErrorCode.InternalError, `Failed to change issue status: ${(error as Error).message}` ); } } // コメントを追加 const fullPath = await writeToTempFile(args.body, tempFile); try { await execAsync( `gh issue comment ${args.issue_number} --repo ${args.repo} --body-file "${fullPath}"` ); } catch (error) { console.error('Failed to add comment:', error); throw new McpError( ErrorCode.InternalError, `Failed to add comment: ${(error as Error).message}` ); } // 更新後のissue情報を取得して返却 try { const { stdout: issueData } = await execAsync( `gh issue view ${args.issue_number} --repo ${args.repo} --json number,title,state,url` ); return { content: [ { type: 'text', text: issueData, }, ], }; } catch (error) { console.error('Failed to get issue data:', error); throw new McpError( ErrorCode.InternalError, `Failed to get issue data: ${(error as Error).message}` ); } } finally { await removeTempFile(tempFile); } }
  • JSON schema defining the input parameters for the add_comment tool: repo, issue_number, body, and optional state.
    export const addCommentSchema = { type: 'object', properties: { repo: { type: 'string', description: 'GitHubリポジトリ名', }, issue_number: { type: 'string', description: 'タスク(Issue)のID', }, body: { type: 'string', description: 'コメントの内容(Markdown形式対応)', }, state: { type: 'string', enum: ['open', 'closed'], description: 'コメント時に変更するissueの状態(オプション)', }, }, required: ['repo', 'issue_number', 'body'], };
  • src/server.ts:57-60 (registration)
    Registration of the 'add_comment' tool in the MCP server's listTools response, specifying name, description, and input schema.
    name: 'add_comment', description: 'タスクにコメントを追加', inputSchema: addCommentSchema, },
  • Dispatcher logic in handleToolRequest that validates arguments and calls the handleAddComment function for the 'add_comment' tool.
    case 'add_comment': { if (!args?.issue_number || !args?.body) { throw new McpError(ErrorCode.InvalidParams, 'Issue number and body are required'); } return await handleAddComment({ repo: fullRepo, issue_number: args.issue_number as string, body: args.body as string, }); }

Other Tools

Related 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/Sunwood-ai-labs/github-kanban-mcp-server'

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