coda_duplicate_page
Copy a page within a Coda document by specifying the document ID, page ID or name, and the new page name. Use this tool to replicate content efficiently.
Instructions
Duplicate a page in the current document
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docId | Yes | The ID of the document that contains the page to duplicate | |
| newName | Yes | The name of the new page | |
| pageIdOrName | Yes | The ID or name of the page to duplicate |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"docId": {
"description": "The ID of the document that contains the page to duplicate",
"type": "string"
},
"newName": {
"description": "The name of the new page",
"type": "string"
},
"pageIdOrName": {
"description": "The ID or name of the page to duplicate",
"type": "string"
}
},
"required": [
"docId",
"pageIdOrName",
"newName"
],
"type": "object"
}
Implementation Reference
- src/server.ts:220-245 (handler)Registration, input schema, and handler implementation for the 'coda_duplicate_page' tool. The handler retrieves the markdown content of the source page and creates a new page in the same document with the copied content.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 }; } }, );