Skip to main content
Glama

fork_repository

Create a copy of a GitHub repository to your personal account or specified organization using owner and repo details. Enables easier collaboration and experimentation.

Instructions

Fork a GitHub repository to your account or specified organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationNoOptional: organization to fork to (defaults to your personal account)
ownerYesRepository owner (username or organization)
repoYesRepository name

Implementation Reference

  • index.ts:106-108 (registration)
    Registration of the 'fork_repository' tool in the MCP server's list of tools, including name, description, and input schema reference.
    name: "fork_repository",
    description: "Fork a GitHub repository to your account or specified organization",
    inputSchema: zodToJsonSchema(repository.ForkRepositorySchema),
  • MCP CallToolRequest handler for 'fork_repository': parses input arguments using the schema, calls the forkRepository function, and returns the result as JSON text content.
    case "fork_repository": {
      const args = repository.ForkRepositorySchema.parse(request.params.arguments);
      const fork = await repository.forkRepository(args.owner, args.repo, args.organization);
      return {
        content: [{ type: "text", text: JSON.stringify(fork, null, 2) }],
      };
    }
  • Zod schema defining the input parameters for the fork_repository tool: owner, repo, and optional organization.
    export const ForkRepositorySchema = z.object({
      owner: z.string().describe("Repository owner (username or organization)"),
      repo: z.string().describe("Repository name"),
      organization: z.string().optional().describe("Optional: organization to fork to (defaults to your personal account)"),
    });
  • Core implementation function that constructs the GitHub forks API URL (with optional organization), performs POST request via githubRequest utility, parses and returns the forked repository response with extended schema.
    export async function forkRepository(
      owner: string,
      repo: string,
      organization?: string
    ) {
      const url = organization
        ? `https://api.github.com/repos/${owner}/${repo}/forks?organization=${organization}`
        : `https://api.github.com/repos/${owner}/${repo}/forks`;
    
      const response = await githubRequest(url, { method: "POST" });
      return GitHubRepositorySchema.extend({
        parent: GitHubRepositorySchema,
        source: GitHubRepositorySchema,
      }).parse(response);
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states the action but doesn't disclose critical traits like authentication requirements, rate limits, whether it's a write operation, what happens on success/failure, or if it triggers notifications. 'Fork' implies a write, but this isn't explicitly confirmed.

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's front-loaded with the core action and resource, making it easy to parse quickly.

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 (forking implies writing) with no annotations and no output schema, the description is incomplete. It lacks details on authentication, permissions, error handling, return values, or how it fits into the GitHub workflow context. This leaves significant gaps for an AI agent to use it correctly.

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 all three parameters (owner, repo, organization). The description adds no additional meaning beyond implying the default behavior for 'organization' (personal account), which is already covered in the schema description. Baseline 3 is appropriate as the schema does the heavy lifting.

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 GitHub repository') with the destination ('to your account or specified organization'). It's specific but doesn't explicitly differentiate from siblings like 'create_repository' which creates a new repository rather than forking an existing one.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., authentication, permissions), when not to use it, or how it compares to similar tools like 'create_repository' or 'clone' operations.

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/tuanle96/mcp-github'

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