Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

fork-repository

Create a copy of a GitHub repository to your personal account or specified organization, enabling independent development and experimentation without affecting the original codebase.

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

  • The main handler function that executes the fork-repository tool logic using GitHub's Octokit API to create a fork of the specified repository.
    export async function forkRepository(args: unknown): Promise<any> {
      const { owner, repo, organization } = args as { owner: string; repo: string; organization?: string };
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().repos.createFork({
          owner,
          repo,
          organization,
        });
    
        return {
          id: data.id,
          name: data.name,
          full_name: data.full_name,
          owner: {
            login: data.owner.login,
            id: data.owner.id,
            type: data.owner.type,
          },
          private: data.private,
          html_url: data.html_url,
          description: data.description,
          fork: data.fork,
          created_at: data.created_at,
          updated_at: data.updated_at,
          pushed_at: data.pushed_at,
          default_branch: data.default_branch,
          parent: data.parent ? {
            name: data.parent.name,
            full_name: data.parent.full_name,
            owner: {
              login: data.parent.owner.login,
            },
          } : null,
          source: data.source ? {
            name: data.source.name,
            full_name: data.source.full_name,
            owner: {
              login: data.source.owner.login,
            },
          } : null,
        };
      }, 'Failed to fork repository');
    }
  • Input schema and metadata definition for the 'fork-repository' tool, registered with the MCP server.
    {
      name: 'fork-repository',
      description: 'Fork a GitHub repository to your account or specified organization',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
            description: 'Repository owner (username or organization)',
          },
          repo: {
            type: 'string',
            description: 'Repository name',
          },
          organization: {
            type: 'string',
            description: 'Optional: organization to fork to (defaults to your personal account)',
          },
        },
        required: ['owner', 'repo'],
        additionalProperties: false,
      },
    },
  • Dispatch registration in the tool call handler switch statement, routing 'fork-repository' calls to the forkRepository function.
    case 'fork-repository':
      result = await forkRepository(parsedArgs);
      break;
  • src/server.ts:25-31 (registration)
    Import statement registering the forkRepository handler from the tools/files module.
    import {
      createOrUpdateFile,
      pushFiles,
      getFileContents,
      forkRepository,
      getPullRequestFiles,
    } from './tools/files.js';
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action ('Fork') but doesn't disclose behavioral traits like whether this requires authentication, rate limits, what happens to existing forks, or the response format. For a mutation tool with zero annotation coverage, this is a significant gap.

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 with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns, error conditions, or important behavioral context like authentication needs. Given the complexity of forking (which involves permissions and network effects), more guidance is needed.

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 already documents all three parameters. The description adds minimal value beyond the schema by implying the 'organization' parameter is optional and defaults to personal account, but doesn't provide additional syntax or format details. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose5/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 specific destination options ('to your account or specified organization'). It distinguishes from siblings like 'create-repository' (new repo) and 'delete-repository' (removal).

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

Usage Guidelines3/5

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

The description implies usage when needing to copy a repository, but doesn't explicitly state when to use this versus alternatives like 'create-repository' for a new repo or clarify prerequisites. It mentions the default personal account behavior, which provides some context.

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

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