Skip to main content
Glama

fork_repository

Create a copy of a GitLab project in your account or specified namespace to modify code independently from the original repository.

Instructions

Fork a GitLab project to your account or specified namespace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or URL-encoded path
namespaceNoNamespace to fork to (full path)

Implementation Reference

  • The implementation of `forkProject` that handles the API call for forking a repository.
    export async function forkProject(projectId: string, namespace?: string): Promise<GitLabFork> {
      if (!projectId?.trim()) {
        throw new Error("Project ID is required");
      }
    
      const endpoint = `/projects/${encodeProjectId(projectId)}/fork`;
      const body = namespace ? { namespace } : undefined;
    
      const fork = await gitlabPost<GitLabFork>(endpoint, body);
      return GitLabForkSchema.parse(fork);
    }
  • src/server.ts:221-225 (registration)
    The MCP tool registration and request handler switch case for `fork_repository`.
    case "fork_repository": {
      const args = ForkRepositorySchema.parse(request.params.arguments);
      const fork = await api.forkProject(args.project_id, args.namespace);
      return { content: [{ type: "text", text: JSON.stringify(fork, null, 2) }] };
    }
  • Definition of the input parameters for the `fork_repository` tool.
    export const ForkRepositorySchema = ProjectParamsSchema.extend({
      namespace: z.string().optional().describe("Namespace to fork to (full path)")
    });
    
    export const CreateBranchSchema = ProjectParamsSchema.extend({
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Fork') but doesn't mention permissions required, whether it's idempotent, rate limits, or what happens if the fork already exists. This leaves critical behavioral traits undocumented for a mutation operation.

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 with zero waste. It front-loads the key action and resource, making it easy to scan and understand quickly without unnecessary details.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It lacks information on permissions, error conditions, return values, and how it differs from similar operations. Given the complexity of forking in GitLab, more context is needed to guide effective use.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents both parameters. The description adds minimal value by implying the 'namespace' parameter is optional (since it says 'or specified namespace'), but this is already clear from the schema's required fields. No additional semantics beyond the schema are provided.

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 resource ('a GitLab project'), specifying the target ('to your account or specified namespace'). It distinguishes from siblings like 'create_repository' by focusing on forking rather than creating from scratch. However, it doesn't explicitly differentiate from tools like 'push_files' or 'update_merge_request' in terms of Git operations.

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 like 'create_repository' or other Git operations. It mentions the target namespace but doesn't specify prerequisites, such as needing access to the source project or when forking is appropriate versus cloning or creating new repositories.

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

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/TheRealChrisThomas/gitlab-mcp-server'

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