update-repository
Modify GitHub Enterprise repository settings including description, privacy, default branch, and feature toggles for issues, projects, wiki, and archive status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner | |
| repo | Yes | Repository name | |
| description | No | New description | |
| private | No | Change privacy setting | |
| default_branch | No | Change default branch | |
| has_issues | No | Enable/disable issues | |
| has_projects | No | Enable/disable projects | |
| has_wiki | No | Enable/disable wiki | |
| archived | No | Archive/unarchive repository |
Implementation Reference
- server/index.ts:1052-1098 (handler)Main MCP tool handler for 'update-repository': validates parameters owner/repo, calls underlying RepositoryAPI.updateRepository, formats and returns the updated repository info or error.async ({ owner, repo, ...options }) => { try { // Parameter validation if (!owner || typeof owner !== 'string' || owner.trim() === '') { return { content: [ { type: "text", text: "Repository owner is required." } ] }; } if (!repo || typeof repo !== 'string' || repo.trim() === '') { return { content: [ { type: "text", text: "Repository name is required." } ] }; } const repository = await context.repository.updateRepository(owner, repo, options); const formattedRepo = formatRepository(repository); return { content: [ { type: "text", text: `Successfully updated repository: ${formattedRepo.full_name}\n\n${JSON.stringify(formattedRepo, null, 2)}` } ] }; } catch (error: any) { return { content: [ { type: "text", text: `Error updating repository: ${error.message}` } ] }; } }
- server/index.ts:1039-1099 (registration)MCP server registration of the 'update-repository' tool with input schema and handler referenceserver.tool( "update-repository", { owner: z.string().min(1).describe("Repository owner"), repo: z.string().min(1).describe("Repository name"), description: z.string().optional().describe("New description"), private: z.boolean().optional().describe("Change privacy setting"), default_branch: z.string().optional().describe("Change default branch"), has_issues: z.boolean().optional().describe("Enable/disable issues"), has_projects: z.boolean().optional().describe("Enable/disable projects"), has_wiki: z.boolean().optional().describe("Enable/disable wiki"), archived: z.boolean().optional().describe("Archive/unarchive repository") }, async ({ owner, repo, ...options }) => { try { // Parameter validation if (!owner || typeof owner !== 'string' || owner.trim() === '') { return { content: [ { type: "text", text: "Repository owner is required." } ] }; } if (!repo || typeof repo !== 'string' || repo.trim() === '') { return { content: [ { type: "text", text: "Repository name is required." } ] }; } const repository = await context.repository.updateRepository(owner, repo, options); const formattedRepo = formatRepository(repository); return { content: [ { type: "text", text: `Successfully updated repository: ${formattedRepo.full_name}\n\n${JSON.stringify(formattedRepo, null, 2)}` } ] }; } catch (error: any) { return { content: [ { type: "text", text: `Error updating repository: ${error.message}` } ] }; } } );
- server/index.ts:1041-1051 (schema)Input schema (zod) for the update-repository MCP tool defining parameters like owner, repo, description, private, etc.{ owner: z.string().min(1).describe("Repository owner"), repo: z.string().min(1).describe("Repository name"), description: z.string().optional().describe("New description"), private: z.boolean().optional().describe("Change privacy setting"), default_branch: z.string().optional().describe("Change default branch"), has_issues: z.boolean().optional().describe("Enable/disable issues"), has_projects: z.boolean().optional().describe("Enable/disable projects"), has_wiki: z.boolean().optional().describe("Enable/disable wiki"), archived: z.boolean().optional().describe("Archive/unarchive repository") },
- api/repos/repository.ts:70-75 (handler)Underlying GitHub API handler in RepositoryAPI class: performs PATCH request to update repository settings./** * Update repository */ async updateRepository(owner: string, repo: string, options: UpdateRepoOptions): Promise<GitHubRepository> { return this.client.patch<GitHubRepository>(`repos/${owner}/${repo}`, options); }
- api/repos/types.ts:114-132 (schema)TypeScript interface defining options for repository update (UpdateRepoOptions) used by the API handler.export interface UpdateRepoOptions { name?: string; description?: string; homepage?: string; private?: boolean; visibility?: 'public' | 'private' | 'internal'; has_issues?: boolean; has_projects?: boolean; has_wiki?: boolean; has_downloads?: boolean; has_discussions?: boolean; default_branch?: string; allow_squash_merge?: boolean; allow_merge_commit?: boolean; allow_rebase_merge?: boolean; allow_auto_merge?: boolean; delete_branch_on_merge?: boolean; archived?: boolean; }