Skip to main content
Glama

coda_replace_page_content

Replace existing page content in a Coda document with new markdown content by specifying the document ID, page ID or name, and updated content.

Instructions

Replace the content of a page with new markdown content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe markdown content to replace the page with
docIdYesThe ID of the document that contains the page to replace the content of
pageIdOrNameYesThe ID or name of the page to replace the content of

Implementation Reference

  • The handler function that implements the core logic of the tool by calling the updatePage SDK function with insertionMode 'replace' to update the page content with the provided markdown.
    async ({ docId, pageIdOrName, content }): Promise<CallToolResult> => { try { const resp = await updatePage({ path: { docId, pageIdOrName, }, body: { // @ts-expect-error auto-generated client types contentUpdate: { insertionMode: "replace", canvasContent: { format: "markdown", content }, }, }, throwOnError: true, }); return { content: [{ type: "text", text: JSON.stringify(resp.data) }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to replace page content: ${error}` }], isError: true }; } },
  • Zod input schema defining the parameters for the tool: docId, pageIdOrName, and content.
    { docId: z.string().describe("The ID of the document that contains the page to replace the content of"), pageIdOrName: z.string().describe("The ID or name of the page to replace the content of"), content: z.string().describe("The markdown content to replace the page with"), },
  • src/server.ts:156-186 (registration)
    The server.tool call that registers the coda_replace_page_content tool with its description, schema, and handler.
    server.tool( "coda_replace_page_content", "Replace the content of a page with new markdown content", { docId: z.string().describe("The ID of the document that contains the page to replace the content of"), pageIdOrName: z.string().describe("The ID or name of the page to replace the content of"), content: z.string().describe("The markdown content to replace the page with"), }, async ({ docId, pageIdOrName, content }): Promise<CallToolResult> => { try { const resp = await updatePage({ path: { docId, pageIdOrName, }, body: { // @ts-expect-error auto-generated client types contentUpdate: { insertionMode: "replace", canvasContent: { format: "markdown", content }, }, }, throwOnError: true, }); return { content: [{ type: "text", text: JSON.stringify(resp.data) }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to replace page content: ${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