create_repository
Create a new GitLab project with customizable visibility, description, and README initialization to organize code repositories.
Instructions
Create a new GitLab project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Repository name | |
| description | No | Repository description | |
| visibility | No | Repository visibility level | |
| initialize_with_readme | No | Initialize with README.md |
Implementation Reference
- src/api/projects.ts:32-45 (handler)The implementation of the 'createRepository' tool which uses gitlabPost to call the GitLab API to create a new project.
export async function createRepository(options: CreateRepositoryOptions): Promise<GitLabRepository> { if (!options?.name?.trim()) { throw new Error("Repository name is required"); } const repository = await gitlabPost<GitLabRepository>("/projects", { name: options.name, description: options.description, visibility: options.visibility, initialize_with_readme: options.initialize_with_readme }); return GitLabRepositorySchema.parse(repository); } - src/server.ts:249-253 (registration)The handler case for 'create_repository' within the MCP server's CallToolRequest handler.
case "create_repository": { const args = CreateRepositorySchema.parse(request.params.arguments); const repository = await api.createRepository(args); return { content: [{ type: "text", text: JSON.stringify(repository, null, 2) }] }; } - src/schemas.ts:238-240 (schema)The Zod schema definition for 'CreateRepositorySchema' used for input validation of the 'create_repository' tool.
export const CreateRepositorySchema = z.object({ name: z.string().describe("Repository name"), description: z.string().optional().describe("Repository description"),