pages
Manage Notion pages by creating, updating, archiving, restoring, duplicating, and retrieving markdown content through lifecycle operations.
Instructions
Page lifecycle: create, get, update, archive, restore, duplicate. Requires parent_id for create. Returns markdown content for get.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform | |
| page_id | No | Page ID (required for most actions) | |
| page_ids | No | Multiple page IDs for batch operations | |
| title | No | Page title | |
| content | No | Markdown content | |
| append_content | No | Markdown to append | |
| prepend_content | No | Markdown to prepend | |
| parent_id | No | Parent page or database ID | |
| properties | No | Page properties (for database pages) | |
| icon | No | Emoji icon | |
| cover | No | Cover image URL | |
| archived | No | Archive status |
Implementation Reference
- src/tools/composite/pages.ts:37-64 (handler)Main exported handler function for the 'pages' tool. Dispatches to sub-functions based on input.action for create, get, update, archive/restore, duplicate operations.export async function pages(notion: Client, input: PagesInput): Promise<any> { return withErrorHandling(async () => { switch (input.action) { case 'create': return await createPage(notion, input) case 'get': return await getPage(notion, input) case 'update': return await updatePage(notion, input) case 'archive': case 'restore': return await archivePage(notion, input) case 'duplicate': return await duplicatePage(notion, input) default: throw new NotionMCPError( `Unknown action: ${input.action}`, 'VALIDATION_ERROR', 'Supported actions: create, get, update, archive, restore, move, duplicate' ) } })() }
- src/tools/composite/pages.ts:13-32 (schema)TypeScript interface defining the input schema for the pages tool.export interface PagesInput { action: 'create' | 'get' | 'update' | 'archive' | 'restore' | 'duplicate' // Common params page_id?: string page_ids?: string[] // Create/Update params title?: string content?: string // Markdown append_content?: string prepend_content?: string parent_id?: string properties?: Record<string, any> icon?: string cover?: string // Archive/Restore params archived?: boolean }
- src/tools/registry.ts:55-81 (registration)Tool registration in the TOOLS array, including name, description, and JSON inputSchema used by MCP.{ name: 'pages', description: 'Page lifecycle: create, get, update, archive, restore, duplicate. Requires parent_id for create. Returns markdown content for get.', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['create', 'get', 'update', 'archive', 'restore', 'duplicate'], description: 'Action to perform' }, page_id: { type: 'string', description: 'Page ID (required for most actions)' }, page_ids: { type: 'array', items: { type: 'string' }, description: 'Multiple page IDs for batch operations' }, title: { type: 'string', description: 'Page title' }, content: { type: 'string', description: 'Markdown content' }, append_content: { type: 'string', description: 'Markdown to append' }, prepend_content: { type: 'string', description: 'Markdown to prepend' }, parent_id: { type: 'string', description: 'Parent page or database ID' }, properties: { type: 'object', description: 'Page properties (for database pages)' }, icon: { type: 'string', description: 'Emoji icon' }, cover: { type: 'string', description: 'Cover image URL' }, archived: { type: 'boolean', description: 'Archive status' } }, required: ['action'] } },
- src/tools/registry.ts:296-298 (registration)Dispatch in CallToolRequestSchema handler that invokes the pages tool function.case 'pages': result = await pages(notion, args as any) break
- src/tools/registry.ts:23-23 (registration)Import statement for the pages handler from its implementation file.import { pages } from './composite/pages.js'