coda_append_page_content
Add markdown content to the end of a specified page in a Coda document by providing the document ID, page ID or name, and the content to append.
Instructions
Append new markdown content to the end of a page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The markdown content to append to the page | |
| docId | Yes | The ID of the document that contains the page to append the content to | |
| pageIdOrName | Yes | The ID or name of the page to append the content to |
Implementation Reference
- src/server.ts:196-217 (handler)The handler function that appends markdown content to the end of a specified page by calling the updatePage SDK function with insertionMode set to 'append'. Handles errors by returning an error message.async ({ docId, pageIdOrName, content }): Promise<CallToolResult> => { try { const resp = await updatePage({ path: { docId, pageIdOrName, }, body: { // @ts-expect-error auto-generated client types contentUpdate: { insertionMode: "append", canvasContent: { format: "markdown", content }, }, }, throwOnError: true, }); return { content: [{ type: "text", text: JSON.stringify(resp.data) }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to append page content: ${error}` }], isError: true }; } },
- src/server.ts:191-195 (schema)Zod input schema defining the parameters: docId, pageIdOrName, and content for the tool.{ docId: z.string().describe("The ID of the document that contains the page to append the content to"), pageIdOrName: z.string().describe("The ID or name of the page to append the content to"), content: z.string().describe("The markdown content to append to the page"), },
- src/server.ts:188-218 (registration)Registers the 'coda_append_page_content' tool with McpServer, including name, description, input schema, and handler function.server.tool( "coda_append_page_content", "Append new markdown content to the end of a page", { docId: z.string().describe("The ID of the document that contains the page to append the content to"), pageIdOrName: z.string().describe("The ID or name of the page to append the content to"), content: z.string().describe("The markdown content to append to the page"), }, async ({ docId, pageIdOrName, content }): Promise<CallToolResult> => { try { const resp = await updatePage({ path: { docId, pageIdOrName, }, body: { // @ts-expect-error auto-generated client types contentUpdate: { insertionMode: "append", canvasContent: { format: "markdown", content }, }, }, throwOnError: true, }); return { content: [{ type: "text", text: JSON.stringify(resp.data) }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to append page content: ${error}` }], isError: true }; } }, );