coda_list_pages
Retrieve and paginate through pages in a Coda document by specifying the document ID, limiting the number of pages returned, and using a token for subsequent results.
Instructions
List pages in the current document with pagination
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docId | Yes | The ID of the document to list pages from | |
| limit | No | The number of pages to return - optional, defaults to 25 | |
| nextPageToken | No | The token need to get the next page of results, returned from a previous call to this tool - optional |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"docId": {
"description": "The ID of the document to list pages from",
"type": "string"
},
"limit": {
"description": "The number of pages to return - optional, defaults to 25",
"exclusiveMinimum": 0,
"type": "integer"
},
"nextPageToken": {
"description": "The token need to get the next page of results, returned from a previous call to this tool - optional",
"type": "string"
}
},
"required": [
"docId"
],
"type": "object"
}
Implementation Reference
- src/server.ts:47-66 (handler)Handler function that implements the core logic of the coda_list_pages tool by invoking the listPages SDK function with pagination support and handling errors.async ({ docId, limit, nextPageToken }): Promise<CallToolResult> => { try { const listLimit = nextPageToken ? undefined : limit; const resp = await listPages({ path: { docId }, query: { limit: listLimit, pageToken: nextPageToken ?? undefined }, throwOnError: true, }); return { content: [{ type: "text", text: JSON.stringify(resp.data) }], }; } catch (error) { return { content: [{ type: "text", text: `Failed to list pages: ${error}` }], isError: true, }; } },
- src/server.ts:38-46 (schema)Zod schema defining the input parameters for the coda_list_pages tool: docId (required string), limit (optional positive integer), nextPageToken (optional string).docId: z.string().describe("The ID of the document to list pages from"), limit: z.number().int().positive().optional().describe("The number of pages to return - optional, defaults to 25"), nextPageToken: z .string() .optional() .describe( "The token need to get the next page of results, returned from a previous call to this tool - optional", ), },
- src/server.ts:34-67 (registration)Full registration of the coda_list_pages tool with the McpServer instance, specifying name, description, input schema, and inline handler function.server.tool( "coda_list_pages", "List pages in the current document with pagination", { docId: z.string().describe("The ID of the document to list pages from"), limit: z.number().int().positive().optional().describe("The number of pages to return - optional, defaults to 25"), nextPageToken: z .string() .optional() .describe( "The token need to get the next page of results, returned from a previous call to this tool - optional", ), }, async ({ docId, limit, nextPageToken }): Promise<CallToolResult> => { try { const listLimit = nextPageToken ? undefined : limit; const resp = await listPages({ path: { docId }, query: { limit: listLimit, pageToken: nextPageToken ?? undefined }, throwOnError: true, }); return { content: [{ type: "text", text: JSON.stringify(resp.data) }], }; } catch (error) { return { content: [{ type: "text", text: `Failed to list pages: ${error}` }], isError: true, }; } }, );