update-issue
Modify existing GitHub repository issues by updating titles, descriptions, assignees, milestones, labels, or status through the GitHub Enterprise MCP Server.
Instructions
Update an existing issue in a GitHub repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignees | No | ||
| body | No | ||
| issue_number | Yes | ||
| labels | No | ||
| milestone | No | ||
| owner | Yes | ||
| repo | Yes | ||
| state | No | ||
| title | No |
Implementation Reference
- src/tools/issues.ts:184-225 (handler)The primary handler function for the 'update-issue' tool. It validates the input parameters using UpdateIssueSchema, calls the GitHub API to update the specified issue, and returns a formatted response with the updated issue details.export async function updateIssue(args: unknown): Promise<any> { const { owner, repo, issue_number, title, body, assignees, milestone, labels, state } = UpdateIssueSchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { const { data } = await github.getOctokit().issues.update({ owner, repo, issue_number, title, body, assignees, milestone, labels, state, }); return { id: data.id, number: data.number, title: data.title, state: data.state, assignees: data.assignees?.map((assignee) => ({ login: assignee.login, id: assignee.id, })), labels: data.labels?.map((label) => typeof label === 'string' ? label : { name: label.name, color: label.color, } ), milestone: data.milestone ? { number: data.milestone.number, title: data.milestone.title, } : null, updated_at: data.updated_at, body: data.body, url: data.html_url, }; }, 'Failed to update issue'); }
- src/utils/validation.ts:99-107 (schema)Zod schema used for input validation in the updateIssue handler, extending OwnerRepoSchema with optional update fields.export const UpdateIssueSchema = OwnerRepoSchema.extend({ issue_number: z.number().int().positive(), title: z.string().optional(), body: z.string().optional(), assignees: z.array(z.string()).optional(), milestone: z.number().optional(), labels: z.array(z.string()).optional(), state: z.enum(['open', 'closed']).optional(), });
- src/server.ts:624-668 (registration)MCP tool registration including name, description, and input schema definition passed to server.setTools().{ name: 'update-issue', description: 'Update an existing issue in a GitHub repository', inputSchema: { type: 'object', properties: { owner: { type: 'string', }, repo: { type: 'string', }, issue_number: { type: 'number', }, title: { type: 'string', }, body: { type: 'string', }, assignees: { type: 'array', items: { type: 'string', }, }, milestone: { type: 'number', }, labels: { type: 'array', items: { type: 'string', }, }, state: { type: 'string', enum: ['open', 'closed'], }, }, required: ['owner', 'repo', 'issue_number'], additionalProperties: false, }, },
- src/server.ts:1218-1220 (registration)Dispatch case in the MCP request handler that routes 'update-issue' calls to the updateIssue function.case 'update-issue': result = await updateIssue(parsedArgs); break;
- src/utils/github-api.ts:1-32 (helper)Shared GitHub API client utility (getGitHubApi) used by the handler to obtain the Octokit instance.import { Octokit } from '@octokit/rest'; import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js'; /** * GitHub API client wrapper */ export class GitHubApi { private octokit: Octokit; private baseUrl?: string; /** * Create a new GitHub API client * @param token GitHub Personal Access Token * @param baseUrl Optional base URL for GitHub Enterprise */ constructor(token: string, baseUrl?: string) { if (!token) { throw new McpError( ErrorCode.ConfigurationError, 'GitHub Personal Access Token is required' ); } this.baseUrl = baseUrl; this.octokit = new Octokit({ auth: token, ...(baseUrl ? { baseUrl } : {}), }); } /** * Get the Octokit instance