Skip to main content
Glama

fork_repository

Fork a GitLab project to your account or a specific namespace using this tool. Simplify repository duplication and manage projects efficiently with precise namespace control.

Instructions

Fork a GitLab project to your account or specified namespace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceNo
project_idNo

Implementation Reference

  • Handler for the fork_repository tool that parses input arguments using the schema, delegates to GitLabApi.forkProject helper, and formats the response as JSON text.
    case "fork_repository": {
      const args = ForkRepositorySchema.parse(request.params.arguments);
      const fork = await gitlabApi.forkProject(args.project_id, args.namespace);
      return { content: [{ type: "text", text: JSON.stringify(fork, null, 2) }] };
    }
  • Zod schema defining the input structure for the fork_repository tool: project_id (required string) and optional namespace.
    export const ForkRepositorySchema = z.object({
      project_id: z.string(),
      namespace: z.string().optional()
    });
  • src/index.ts:150-154 (registration)
    Tool registration in the ALL_TOOLS array, specifying name, description, input schema conversion, and readOnly flag.
    {
      name: "fork_repository",
      description: "Fork a GitLab project to your account or specified namespace",
      inputSchema: createJsonSchema(ForkRepositorySchema),
      readOnly: false
  • Implementation of forkProject method in GitLabApi class that makes the POST request to GitLab's /projects/{id}/fork endpoint, handles response, and validates with GitLabForkSchema.
    async forkProject(
      projectId: string,
      namespace?: string
    ): Promise<GitLabFork> {
      const url = `${this.apiUrl}/projects/${encodeURIComponent(projectId)}/fork`;
      const queryParams = namespace ? `?namespace=${encodeURIComponent(namespace)}` : '';
    
      const response = await fetch(url + queryParams, {
        method: "POST",
        headers: {
          "Authorization": `Bearer ${this.token}`,
          "Content-Type": "application/json"
        }
      });
    
      if (!response.ok) {
        throw new McpError(
          ErrorCode.InternalError,
          `GitLab API error: ${response.statusText}`
        );
      }
    
      return GitLabForkSchema.parse(await response.json());
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Fork') but doesn't explain what forking entails (e.g., copying the repository, preserving history, setting up permissions), whether it requires authentication, potential rate limits, or what the output looks like. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and resource. Every word contributes directly to understanding the tool's purpose without any fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a forking operation (a mutation with no annotations, 2 parameters at 0% schema coverage, and no output schema), the description is inadequate. It lacks details on behavior, parameter usage, output format, and error conditions, leaving the agent poorly equipped to use this tool correctly in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'namespace' and implies 'project_id' through 'GitLab project', but doesn't explain what these parameters represent (e.g., namespace as destination, project_id as source), their formats, or examples. This adds minimal value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Fork') and target resource ('a GitLab project'), specifying the destination ('to your account or specified namespace'). It distinguishes from siblings like 'create_repository' by focusing on forking existing projects rather than creating new ones from scratch. However, it doesn't explicitly contrast with other sibling tools beyond this basic differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing access to the source project), exclusions, or comparisons with similar tools like 'create_repository' for starting fresh projects. The agent must infer usage from the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yoda-digital/mcp-gitlab-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server