update-repository
Modify GitHub repository settings including description, privacy, default branch, and enable/disable features like issues, projects, wiki, or archive status.
Instructions
Update an existing GitHub repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| archived | No | Archive/unarchive repository | |
| default_branch | No | Change default branch | |
| description | No | New description | |
| has_issues | No | Enable/disable issues | |
| has_projects | No | Enable/disable projects | |
| has_wiki | No | Enable/disable wiki | |
| owner | Yes | Repository owner | |
| private | No | Change privacy setting | |
| repo | Yes | Repository name |
Implementation Reference
- src/tools/repository.ts:112-154 (handler)The main execution handler for the 'update-repository' tool. Parses arguments using Zod schema, uses GitHub Octokit to update repository settings, wraps in error handling, and returns updated repository details.export async function updateRepository(args: unknown): Promise<any> { const { owner, repo, description, private: isPrivate, default_branch, has_issues, has_projects, has_wiki, archived, } = UpdateRepositorySchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { const { data } = await github.getOctokit().repos.update({ owner, repo, description, private: isPrivate, default_branch, has_issues, has_projects, has_wiki, archived, }); return { id: data.id, name: data.name, full_name: data.full_name, private: data.private, description: data.description, html_url: data.html_url, default_branch: data.default_branch, has_issues: data.has_issues, has_projects: data.has_projects, has_wiki: data.has_wiki, archived: data.archived, updated_at: data.updated_at, }; }, 'Failed to update repository'); }
- src/server.ts:152-197 (registration)MCP tool registration defining the 'update-repository' tool's metadata, description, and input schema for the server.{ name: 'update-repository', description: 'Update an existing GitHub repository', inputSchema: { type: 'object', properties: { owner: { type: 'string', description: 'Repository owner', }, repo: { type: 'string', description: 'Repository name', }, description: { type: 'string', description: 'New description', }, private: { type: 'boolean', description: 'Change privacy setting', }, default_branch: { type: 'string', description: 'Change default branch', }, has_issues: { type: 'boolean', description: 'Enable/disable issues', }, has_projects: { type: 'boolean', description: 'Enable/disable projects', }, has_wiki: { type: 'boolean', description: 'Enable/disable wiki', }, archived: { type: 'boolean', description: 'Archive/unarchive repository', }, }, required: ['owner', 'repo'], additionalProperties: false, },
- src/utils/validation.ts:54-62 (schema)Zod validation schema for 'update-repository' tool inputs, extending OwnerRepoSchema with optional update fields. Used in the handler for argument parsing.export const UpdateRepositorySchema = OwnerRepoSchema.extend({ description: z.string().optional(), private: z.boolean().optional(), default_branch: z.string().optional(), has_issues: z.boolean().optional(), has_projects: z.boolean().optional(), has_wiki: z.boolean().optional(), archived: z.boolean().optional(), });
- src/server.ts:1169-1171 (registration)Dispatch case in the MCP server's tool request handler that routes 'update-repository' calls to the updateRepository function.case 'update-repository': result = await updateRepository(parsedArgs); break;