update_issue
Update GitHub issues by modifying titles, descriptions, status, labels, or assignees. Automates task management through the GitHub Kanban MCP Server, streamlining issue tracking and collaboration.
Instructions
既存のissueを更新します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignees | No | 新しいアサイン | |
| body | No | 新しい本文 | |
| emoji | No | タイトルの先頭に付与する絵文字 | |
| issue_number | Yes | issue番号 | |
| labels | No | 新しいラベル | |
| path | No | Gitリポジトリの絶対パス | |
| state | No | 新しい状態 | |
| title | No | 新しいタイトル |
Implementation Reference
- src/handlers/issue-handlers.ts:103-151 (handler)Core handler function that executes the update_issue tool logic using GitHub CLI (gh) commands to edit issue title, body, labels, assignees, and state.export async function handleUpdateIssue(args: UpdateIssueArgs): Promise<ToolResponse> { const { owner, repo } = await getRepoInfo(args); // タイトルが更新される場合は絵文字を付与(指定がある場合) const titleFlag = args.title ? `--title "${args.emoji ? `${args.emoji} ${args.title}` : args.title}"` : ''; const labelsFlag = args.labels?.length ? `--add-label ${args.labels.join(',')}` : ''; const assigneesFlag = args.assignees?.length ? `--add-assignee ${args.assignees.join(',')}` : ''; const tempFile = 'update_body.md'; let bodyFlag = ''; try { // 状態の更新を処理 if (args.state) { const command = args.state === 'closed' ? 'close' : 'reopen'; await execAsync( `gh issue ${command} ${args.issue_number} --repo ${owner}/${repo}` ); } // その他の更新を処理 if (args.title || args.body || args.labels?.length || args.assignees?.length) { if (args.body) { const fullPath = await writeToTempFile(args.body, tempFile); bodyFlag = `--body-file "${fullPath}"`; } await execAsync( `gh issue edit ${args.issue_number} --repo ${owner}/${repo} ${titleFlag} ${bodyFlag} ${labelsFlag} ${assigneesFlag}` ); } const { stdout: issueData } = await execAsync( `gh issue view ${args.issue_number} --repo ${owner}/${repo} --json number,title,state,url` ); return { content: [ { type: 'text', text: issueData, }, ], }; } finally { if (args.body) { await removeTempFile(tempFile); } } }
- src/handlers/tool-handlers.ts:60-74 (handler)Tool dispatcher switch case that validates inputs and delegates to the specific handleUpdateIssue function.case 'update_issue': { if (!args?.issue_number) { throw new McpError(ErrorCode.InvalidParams, 'Issue number is required'); } return await handleUpdateIssue({ path: args.path as string, issue_number: Number(args.issue_number), title: args?.title as string | undefined, emoji: args?.emoji as string | undefined, body: args?.body as string | undefined, state: args?.state as 'open' | 'closed' | undefined, labels: args?.labels as string[] | undefined, assignees: args?.assignees as string[] | undefined, }); }
- src/server.ts:52-55 (registration)MCP server tool registration listing the 'update_issue' tool with its name, description, and input schema.name: 'update_issue', description: '既存のissueを更新します', inputSchema: updateIssueSchema, },
- src/schemas/issue-schemas.ts:61-105 (schema)JSON schema defining the input structure and validation for the update_issue tool parameters.export const updateIssueSchema = { type: 'object', properties: { path: { type: 'string', description: 'Gitリポジトリの絶対パス', }, issue_number: { type: 'number', description: 'issue番号', }, title: { type: 'string', description: '新しいタイトル', }, emoji: { type: 'string', description: 'タイトルの先頭に付与する絵文字', }, body: { type: 'string', description: '新しい本文', }, state: { type: 'string', enum: ['open', 'closed'], description: '新しい状態', }, labels: { type: 'array', items: { type: 'string', }, description: '新しいラベル', }, assignees: { type: 'array', items: { type: 'string', }, description: '新しいアサイン', }, }, required: ['issue_number'], };
- src/types.ts:16-25 (helper)TypeScript interface defining the arguments for the update_issue handler.export interface UpdateIssueArgs { path: string; // Gitリポジトリの絶対パス issue_number: number; title?: string; emoji?: string; body?: string; state?: 'open' | 'closed'; labels?: string[]; assignees?: string[]; }