Skip to main content
Glama

coda_create_page

Add a new page to a Coda document by specifying the document ID, page name, and optional content or parent page ID for organized structuring.

Instructions

Create a page in the current document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoThe markdown content of the page to create - optional
docIdYesThe ID of the document to create the page in
nameYesThe name of the page to create
parentPageIdNoThe ID of the parent page to create this page under - optional

Implementation Reference

  • Handler function that executes the tool logic: calls createPage from the SDK with provided parameters, handles errors, and returns JSON response or error message.
    async ({ docId, name, content, parentPageId }): Promise<CallToolResult> => {
      try {
        const resp = await createPage({
          path: { docId },
          body: {
            name,
            parentPageId: parentPageId ?? undefined,
            pageContent: {
              type: "canvas",
              canvasContent: { format: "markdown", content: content ?? " " },
            },
          },
          throwOnError: true,
        });
    
        return {
          content: [{ type: "text", text: JSON.stringify(resp.data) }],
        };
      } catch (error) {
        return { content: [{ type: "text", text: `Failed to create page: ${error}` }], isError: true };
      }
    },
  • Zod input schema defining parameters for the tool: docId, name (required), content and parentPageId (optional).
    {
      docId: z.string().describe("The ID of the document to create the page in"),
      name: z.string().describe("The name of the page to create"),
      content: z.string().optional().describe("The markdown content of the page to create - optional"),
      parentPageId: z.string().optional().describe("The ID of the parent page to create this page under - optional"),
    },
  • src/server.ts:69-100 (registration)
    Registration of the coda_create_page tool with the MCP server, including name, description, input schema, and handler function.
    server.tool(
      "coda_create_page",
      "Create a page in the current document",
      {
        docId: z.string().describe("The ID of the document to create the page in"),
        name: z.string().describe("The name of the page to create"),
        content: z.string().optional().describe("The markdown content of the page to create - optional"),
        parentPageId: z.string().optional().describe("The ID of the parent page to create this page under - optional"),
      },
      async ({ docId, name, content, parentPageId }): Promise<CallToolResult> => {
        try {
          const resp = await createPage({
            path: { docId },
            body: {
              name,
              parentPageId: parentPageId ?? undefined,
              pageContent: {
                type: "canvas",
                canvasContent: { format: "markdown", content: content ?? " " },
              },
            },
            throwOnError: true,
          });
    
          return {
            content: [{ type: "text", text: JSON.stringify(resp.data) }],
          };
        } catch (error) {
          return { content: [{ type: "text", text: `Failed to create page: ${error}` }], isError: true };
        }
      },
    );

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