update-page
Update Notion page properties and content using the Notion MCP Server to modify existing pages in your workspace.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page_id | Yes | The ID of the page to update | |
| properties | Yes | JSON string of page properties to update | |
| archived | No | Whether to archive the page |
Implementation Reference
- src/lib/mcp-server.ts:328-361 (handler)The handler function for the 'update-page' MCP tool. It parses the JSON properties input, optionally handles archiving, calls the NotionService.updatePage method, and returns the result as a formatted text content block or an error.async ({ page_id, properties, archived }) => { const params: any = { page_id, properties: JSON.parse(properties), }; if (archived !== undefined) { params.archived = archived; } try { const page = await this.notionService.updatePage(params); return { content: [ { type: "text", text: JSON.stringify(page, null, 2), }, ], }; } catch (error) { console.error("Error in update-page tool:", error); return { content: [ { type: "text", text: `Error: Failed to update page - ${ (error as Error).message }`, }, ], isError: true, }; }
- src/lib/mcp-server.ts:318-327 (schema)Zod schema defining the input parameters for the 'update-page' tool: page_id (required string), properties (required JSON string), archived (optional boolean).{ page_id: z.string().describe("The ID of the page to update"), properties: z .string() .describe("JSON string of page properties to update"), archived: z .boolean() .optional() .describe("Whether to archive the page"), },
- src/lib/mcp-server.ts:316-363 (registration)The registration of the 'update-page' tool on the McpServer instance within the registerPageTools method, including schema and handler.this.server.tool( "update-page", { page_id: z.string().describe("The ID of the page to update"), properties: z .string() .describe("JSON string of page properties to update"), archived: z .boolean() .optional() .describe("Whether to archive the page"), }, async ({ page_id, properties, archived }) => { const params: any = { page_id, properties: JSON.parse(properties), }; if (archived !== undefined) { params.archived = archived; } try { const page = await this.notionService.updatePage(params); return { content: [ { type: "text", text: JSON.stringify(page, null, 2), }, ], }; } catch (error) { console.error("Error in update-page tool:", error); return { content: [ { type: "text", text: `Error: Failed to update page - ${ (error as Error).message }`, }, ], isError: true, }; } } );
- src/lib/notion.ts:195-207 (helper)The NotionService.updatePage helper method invoked by the MCP tool handler. It calls the underlying Notion Client pages.update API with additional optional parameters like icon and cover.async updatePage(params: UpdatePage) { try { return await this.client.pages.update({ page_id: params.page_id, properties: params.properties, archived: params.archived, icon: params.icon, cover: params.cover, }); } catch (error) { this.handleError(error); } }