Skip to main content
Glama

fork_repository

Create a copy of a Gitee repository by specifying the owner and repository paths. Optionally, fork into an organization for collaborative development.

Instructions

Fork Gitee 仓库

Input Schema

NameRequiredDescriptionDefault
organizationNoOrganization path, defaults to personal account if not provided
ownerYesRepository owner path (enterprise, organization, or personal path)
repoYesRepository path

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "organization": { "description": "Organization path, defaults to personal account if not provided", "type": "string" }, "owner": { "description": "Repository owner path (enterprise, organization, or personal path)", "type": "string" }, "repo": { "description": "Repository path", "type": "string" } }, "required": [ "owner", "repo" ], "type": "object" }

Implementation Reference

  • Implements the fork_repository tool by validating inputs, constructing the Gitee API URL `/repos/{owner}/{repo}/forks`, sending a POST request with optional organization, and parsing the response as a repository object.
    export async function forkRepository( owner: string, repo: string, organization?: string ) { owner = validateOwnerName(owner); repo = validateRepositoryName(repo); const url = `/repos/${owner}/${repo}/forks`; const body: Record<string, string> = {}; if (organization) { body.organization = validateOwnerName(organization); } const response = await giteeRequest(url, "POST", body); return GiteeRepositorySchema.parse(response); }
  • Zod schema defining the input parameters for the fork_repository tool: owner (required string), repo (required string), organization (optional string).
    export const ForkRepositorySchema = z.object({ // 仓库所属空间地址 (企业、组织或个人的地址 path) owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"), // 仓库路径 (path) repo: z.string().describe("Repository path"), // 组织空间地址,不传默认为个人 organization: z.string().optional().describe("Organization path, defaults to personal account if not provided"), });
  • index.ts:51-59 (registration)
    Registers the 'fork_repository' tool on the MCP server, referencing the schema and delegating to the forkRepository handler from repoOperations.
    server.registerTool({ name: "fork_repository", description: "Fork Gitee 仓库", schema: repoOperations.ForkRepositorySchema, handler: async (params: any) => { const { owner, repo, organization } = params; return await repoOperations.forkRepository(owner, repo, organization); }, });

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/normal-coder/gitee-mcp-server'

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