create_repository
Create a new GitHub repository in your account with customizable settings for name, description, privacy, and initialization.
Instructions
Create a new GitHub repository in your account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Repository name | |
| description | No | Repository description | |
| private | No | Whether the repository should be private | |
| autoInit | No | Initialize with README.md |
Implementation Reference
- operations/repository.ts:29-35 (handler)Core handler function that executes the GitHub API POST request to /user/repos to create the repository.export async function createRepository(options: CreateRepositoryOptions) { const response = await githubRequest("https://api.github.com/user/repos", { method: "POST", body: options, }); return GitHubRepositorySchema.parse(response); }
- operations/repository.ts:6-11 (schema)Zod schema defining the input parameters for the create_repository tool.export const CreateRepositoryOptionsSchema = z.object({ name: z.string().describe("Repository name"), description: z.string().optional().describe("Repository description"), private: z.boolean().optional().describe("Whether the repository should be private"), autoInit: z.boolean().optional().describe("Initialize with README.md"), });
- index.ts:78-82 (registration)Tool registration in the list of available tools returned by ListToolsRequestHandler.{ name: "create_repository", description: "Create a new GitHub repository in your account", inputSchema: zodToJsonSchema(repository.CreateRepositoryOptionsSchema), },
- index.ts:202-208 (handler)Dispatcher handler in the CallToolRequestHandler switch statement that parses arguments and delegates to the core createRepository function.case "create_repository": { const args = repository.CreateRepositoryOptionsSchema.parse(request.params.arguments); const result = await repository.createRepository(args); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }