Skip to main content
Glama

coda_duplicate_page

Duplicate a page within a Coda document by specifying the original page and a new name. Solves the need to copy existing content for reuse.

Instructions

Duplicate a page in the current document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docIdYesThe ID of the document that contains the page to duplicate
pageIdOrNameYesThe ID or name of the page to duplicate
newNameYesThe name of the new page

Implementation Reference

  • Handler for coda_duplicate_page tool. Fetches page content via getPageContent helper and creates a new page with that content as a canvas markdown page.
    server.tool(
      "coda_duplicate_page",
      "Duplicate a page in the current document",
      {
        docId: z.string().describe("The ID of the document that contains the page to duplicate"),
        pageIdOrName: z.string().describe("The ID or name of the page to duplicate"),
        newName: z.string().describe("The name of the new page"),
      },
      async ({ docId, pageIdOrName, newName }): Promise<CallToolResult> => {
        try {
          const pageContent = await getPageContent(docId, pageIdOrName);
          const createResp = await createPage({
            path: { docId },
            body: {
              name: newName,
              pageContent: { type: "canvas", canvasContent: { format: "markdown", content: pageContent } },
            },
            throwOnError: true,
          });
    
          return { content: [{ type: "text", text: JSON.stringify(createResp.data) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Failed to duplicate page: ${error}` }], isError: true };
        }
      },
    );
  • src/server.ts:231-256 (registration)
    Registration of the coda_duplicate_page tool using server.tool() from the MCP SDK.
    server.tool(
      "coda_duplicate_page",
      "Duplicate a page in the current document",
      {
        docId: z.string().describe("The ID of the document that contains the page to duplicate"),
        pageIdOrName: z.string().describe("The ID or name of the page to duplicate"),
        newName: z.string().describe("The name of the new page"),
      },
      async ({ docId, pageIdOrName, newName }): Promise<CallToolResult> => {
        try {
          const pageContent = await getPageContent(docId, pageIdOrName);
          const createResp = await createPage({
            path: { docId },
            body: {
              name: newName,
              pageContent: { type: "canvas", canvasContent: { format: "markdown", content: pageContent } },
            },
            throwOnError: true,
          });
    
          return { content: [{ type: "text", text: JSON.stringify(createResp.data) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Failed to duplicate page: ${error}` }], isError: true };
        }
      },
    );
  • Zod schema for tool inputs: docId, pageIdOrName, and newName.
    {
      docId: z.string().describe("The ID of the document that contains the page to duplicate"),
      pageIdOrName: z.string().describe("The ID or name of the page to duplicate"),
      newName: z.string().describe("The name of the new page"),
    },
  • Helper function that exports a page to markdown and returns the content, used by the duplicate_page handler.
    export async function getPageContent(docId: string, pageIdOrName: string) {
      let requestId: string | undefined;
      try {
        // Begin page export
        const beginExportResp = await beginPageContentExport({
          path: {
            docId,
            pageIdOrName,
          },
          body: {
            outputFormat: "markdown",
          },
          throwOnError: true,
        });
    
        if (!beginExportResp.data) {
          throw new Error("Failed to begin page content export");
        }
    
        requestId = beginExportResp.data.id;
      } catch (error) {
        throw new Error(`Failed to get page content: ${error}`, { cause: error });
      }
    
      // Poll for export status
      let retries = 0;
      const maxRetries = 5;
      let downloadLink: string | undefined;
    
      while (retries < maxRetries) {
        // Wait for 5 seconds
        await new Promise((resolve) => setTimeout(resolve, 5000));
    
        try {
          const exportStatusResp = await getPageContentExportStatus({
            path: {
              docId,
              pageIdOrName,
              requestId,
            },
            throwOnError: true,
          });
    
          if (exportStatusResp.data?.status === "complete") {
            downloadLink = exportStatusResp.data.downloadLink;
            break;
          }
        } catch (error) {
          throw new Error(`Failed to get page content export status: ${error}`, { cause: error });
        }
    
        retries++;
        if (retries >= maxRetries) {
          throw new Error(`Page content export did not complete after ${maxRetries} retries.`);
        }
      }
    
      if (!downloadLink) {
        throw new Error("Failed to get page content export status");
      }
    
      try {
        const downloadResponse = await axios.get<string>(downloadLink, {
          responseType: "text",
        });
    
        const markdownContent = downloadResponse.data;
    
        return markdownContent;
      } catch {
        throw new Error(`Failed to download exported page content from ${downloadLink}. `);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full responsibility. It discloses the basic action ('duplicate') but omits critical behavioral traits such as whether subpages are duplicated, whether permissions are copied, or what the tool returns. For a mutation operation, 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no wasted words. It is front-loaded and efficient, though it could benefit from additional structured details without becoming verbose. It earns its place but is minimally informative.

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 tool with three required parameters, no output schema, and no annotations, the description is too sparse. It does not explain return behavior (e.g., returns the new page ID?), constraints (e.g., cannot duplicate to another document), or relationship to sibling tools. The agent lacks crucial context to use it effectively.

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?

Input schema covers 100% of parameters with descriptions. The tool description does not add extra meaning beyond what the schema already provides (e.g., it does not explain how 'pageIdOrName' resolves ambiguity between ID and name). Baseline score of 3 is appropriate given schema coverage.

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 'Duplicate a page in the current document', specifying the action (duplicate) and resource (page). It is specific and distinct from creating a page, but does not explicitly differentiate from other page operations like coda_create_page, which is implied but not clarified.

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 on when to use this tool versus alternatives. There is no mention of when not to use it or any distinguishing factors from siblings like coda_create_page or coda_peek_page. The agent must infer usage from 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/orellazri/coda-mcp'

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