Skip to main content
Glama

fork_app

Create a full copy of a published app as a new project, including database, functions, and site, with optional subdomain claiming.

Instructions

Fork a published app into a new project. Creates a full copy including database, functions, site, and optionally claims a subdomain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
version_idYesThe app version ID to fork (from browse_apps)
nameYesName for the new forked project
tierNoDatabase tier: prototype ($0.10/7d), hobby ($5/30d), team ($20/30d)prototype
subdomainNoOptional subdomain to claim for the forked app

Implementation Reference

  • The handleForkApp async function is the main handler that executes the fork_app tool logic. It makes an API request to fork an app, handles payment requirements (x402), saves credentials to the local keystore, and returns formatted results with project details.
    export async function handleForkApp(args: {
      version_id: string;
      name: string;
      tier?: string;
      subdomain?: string;
    }): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: boolean }> {
      const tier = args.tier || "prototype";
    
      const res = await apiRequest(`/v1/fork/${tier}`, {
        method: "POST",
        body: {
          version_id: args.version_id,
          name: args.name,
          subdomain: args.subdomain,
        },
      });
    
      if (res.is402) {
        const body = res.body as Record<string, unknown>;
        const lines = [
          `## Payment Required`,
          ``,
          `To fork this app (tier: **${tier}**), an x402 payment is needed.`,
          ``,
        ];
        if (body.x402) {
          lines.push(`**Payment details:**`);
          lines.push("```json");
          lines.push(JSON.stringify(body.x402, null, 2));
          lines.push("```");
        } else {
          lines.push(`**Server response:**`);
          lines.push("```json");
          lines.push(JSON.stringify(body, null, 2));
          lines.push("```");
        }
        lines.push(``);
        lines.push(
          `The user's wallet or payment agent must send the required amount. ` +
          `Once payment is confirmed, retry this tool call.`,
        );
        return { content: [{ type: "text", text: lines.join("\n") }] };
      }
    
      if (!res.ok) return formatApiError(res, "forking app");
    
      const body = res.body as {
        project_id: string;
        anon_key: string;
        service_key: string;
        schema_slot: string;
        tier: string;
        lease_expires_at: string;
        site_url?: string;
        subdomain_url?: string;
        functions?: Array<{ name: string; url: string }>;
      };
    
      // Save credentials to local key store
      saveProject(body.project_id, {
        anon_key: body.anon_key,
        service_key: body.service_key,
        tier: body.tier,
        expires_at: body.lease_expires_at,
      });
    
      const lines = [
        `## App Forked: ${args.name}`,
        ``,
        `| Field | Value |`,
        `|-------|-------|`,
        `| project_id | \`${body.project_id}\` |`,
        `| tier | ${body.tier} |`,
        `| schema | ${body.schema_slot} |`,
        `| expires | ${body.lease_expires_at} |`,
      ];
    
      if (body.site_url) {
        lines.push(`| site | ${body.site_url} |`);
      }
      if (body.subdomain_url) {
        lines.push(`| subdomain | ${body.subdomain_url} |`);
      }
    
      lines.push(``);
      lines.push(`Keys saved to local key store.`);
    
      return { content: [{ type: "text", text: lines.join("\n") }] };
    }
  • The forkAppSchema defines the input validation schema for the fork_app tool using Zod. It specifies version_id (required), name (required), tier (optional with default 'prototype'), and subdomain (optional) parameters.
    export const forkAppSchema = {
      version_id: z.string().describe("The app version ID to fork (from browse_apps)"),
      name: z.string().describe("Name for the new forked project"),
      tier: z
        .enum(["prototype", "hobby", "team"])
        .default("prototype")
        .describe("Database tier: prototype ($0.10/7d), hobby ($5/30d), team ($20/30d)"),
      subdomain: z
        .string()
        .optional()
        .describe("Optional subdomain to claim for the forked app"),
    };
  • src/index.ts:27-27 (registration)
    Import statement that brings in the forkAppSchema and handleForkApp from the tools/fork-app module, making them available for tool registration.
    import { forkAppSchema, handleForkApp } from "./tools/fork-app.js";
  • src/index.ts:243-248 (registration)
    The fork_app tool is registered with the MCP server using server.tool(). It specifies the tool name, description, input schema, and the handler function that processes requests.
    server.tool(
      "fork_app",
      "Fork a published app into a new project. Creates a full copy including database, functions, site, and optionally claims a subdomain.",
      forkAppSchema,
      async (args) => handleForkApp(args),
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions creating a 'full copy' and optional subdomain claiming, it lacks critical details like whether this is a destructive operation, what permissions are required, whether it consumes resources/balance, or what happens if the subdomain is already taken. For a mutation tool with zero annotation coverage, this is insufficient.

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 perfectly concise - two sentences that efficiently convey the core action, scope, and optional feature. Every word earns its place with no redundancy or unnecessary elaboration. The structure is front-loaded with the primary purpose.

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 that creates new projects with database tiers and optional subdomains, the description is incomplete. With no annotations and no output schema, it should address behavioral aspects like resource consumption, permissions needed, error conditions, or what the tool returns. The current description leaves significant gaps for agent understanding.

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 parameters thoroughly. The description adds minimal value beyond the schema - it mentions 'optionally claims a subdomain' which aligns with the 'subdomain' parameter, but doesn't provide additional context about parameter interactions or usage patterns. 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 specific action ('Fork a published app into a new project') and specifies what gets copied ('full copy including database, functions, site'), distinguishing it from sibling tools like 'publish_app' or 'provision_postgres_project'. It provides a complete picture of the tool's function beyond just the name.

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 context by mentioning 'published app' and 'optionally claims a subdomain', but doesn't explicitly state when to use this tool versus alternatives like 'provision_postgres_project' for new projects or 'claim_subdomain' for standalone subdomain claims. No clear exclusions or prerequisites are provided.

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/kychee-com/run402'

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