delete-repository
Remove a GitHub repository permanently from GitHub Enterprise. This tool requires repository owner, name, and confirmation to delete the repository and all its contents.
Instructions
Delete a GitHub repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | Yes | Confirmation for deletion (must be true) | |
| owner | Yes | Repository owner | |
| repo | Yes | Repository name |
Implementation Reference
- src/tools/repository.ts:159-182 (handler)The main handler function that parses input using DeleteRepositorySchema, checks confirmation, calls GitHub API to delete the repository, and returns success message.export async function deleteRepository(args: unknown): Promise<any> { const { owner, repo, confirm } = DeleteRepositorySchema.parse(args); if (!confirm) { throw new McpError( ErrorCode.InvalidParams, 'You must confirm deletion by setting confirm to true' ); } const github = getGitHubApi(); return tryCatchAsync(async () => { await github.getOctokit().repos.delete({ owner, repo, }); return { success: true, message: `Repository ${owner}/${repo} has been deleted`, }; }, 'Failed to delete repository'); }
- src/utils/validation.ts:64-68 (schema)Zod schema for validating the input parameters of delete-repository tool, extending OwnerRepoSchema and requiring confirm: true.export const DeleteRepositorySchema = OwnerRepoSchema.extend({ confirm: z.boolean().refine(val => val === true, { message: 'You must confirm deletion by setting confirm to true', }), });
- src/server.ts:199-221 (registration)Tool registration in the listTools response, defining the name, description, and input schema for the MCP protocol.{ name: 'delete-repository', description: 'Delete a GitHub repository', inputSchema: { type: 'object', properties: { owner: { type: 'string', description: 'Repository owner', }, repo: { type: 'string', description: 'Repository name', }, confirm: { type: 'boolean', description: 'Confirmation for deletion (must be true)', }, }, required: ['owner', 'repo', 'confirm'], additionalProperties: false, }, },
- src/server.ts:1172-1174 (registration)Dispatch case in the CallToolRequest handler switch statement that invokes the deleteRepository function.case 'delete-repository': result = await deleteRepository(parsedArgs); break;