Skip to main content
Glama
update-page.js3.67 kB
export const updatePageToolDefinition = { name: 'notion_update_page', description: 'Updates properties of a Notion page. Can also update icon, cover, or archive/restore pages.', inputSchema: { type: 'object', properties: { page_id: { type: 'string', description: 'The ID of the page to update' }, properties: { type: 'object', description: 'Properties to update. Keys are property names/IDs, values are property values.' }, in_trash: { type: 'boolean', description: 'Set to true to archive/delete the page, false to restore it' }, icon: { type: 'object', properties: { type: { type: 'string', enum: ['emoji', 'external'] }, emoji: { type: 'string', description: 'Emoji character (if type is emoji)' }, external: { type: 'object', properties: { url: { type: 'string', description: 'URL of external image' } } } }, description: 'Page icon to update' }, cover: { type: 'object', properties: { type: { type: 'string', enum: ['external'] }, external: { type: 'object', properties: { url: { type: 'string', description: 'URL of cover image' } }, required: ['url'] } }, required: ['type', 'external'], description: 'Page cover image to update' } }, required: ['page_id'] } }; export async function handleUpdatePageTool(client, args) { try { const updateArgs = { page_id: args.page_id, ...(args.properties && { properties: args.properties }), ...(args.in_trash !== undefined && { archived: args.in_trash }), ...(args.icon && { icon: args.icon }), ...(args.cover && { cover: args.cover }) }; const response = await client.updatePage(updateArgs); return { content: [ { type: 'text', text: `Successfully updated page: ${response.id}\n` + `URL: ${'url' in response ? response.url : 'N/A'}\n` + `Archived: ${'archived' in response ? response.archived : false}\n` + `Last edited: ${'last_edited_time' in response ? response.last_edited_time : 'N/A'}` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error updating page: ${error.message || 'Unknown error'}` } ], isError: true }; } } export const updatePageTool = { definition: updatePageToolDefinition, handler: handleUpdatePageTool };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/michaelwaves/notion-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server