notion_create_page
Create a new page in Notion as a child of an existing page or database. Define properties, add content blocks, and optionally include icons or cover images.
Instructions
Creates a new page in Notion. Can be a child of a page or database.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| children | No | Optional page content as array of block objects | |
| cover | No | Optional page cover image | |
| icon | No | Optional page icon | |
| parent | Yes | Parent page or database | |
| properties | Yes | Page properties. Must match parent database schema if parent is a database. |
Implementation Reference
- src/tools/create-page.ts:91-122 (handler)The handler function that implements the core logic for creating a Notion page using the NotionClient.export async function handleCreatePageTool(client: NotionClient, args: any) { try { const createArgs: CreatePageArgs = { parent: args.parent, properties: args.properties, ...(args.children && { children: args.children }), ...(args.icon && { icon: args.icon }), ...(args.cover && { cover: args.cover }) }; const response = await client.createPage(createArgs); return { content: [ { type: 'text', text: `Successfully created page with ID: ${response.id}\nURL: ${'url' in response ? response.url : 'N/A'}` } ] }; } catch (error: any) { return { content: [ { type: 'text', text: `Error creating page: ${error.message || 'Unknown error'}` } ], isError: true }; } }
- src/tools/create-page.ts:5-89 (schema)The tool definition including the detailed input schema for validating arguments to notion_create_page.export const createPageToolDefinition: Tool = { name: 'notion_create_page', description: 'Creates a new page in Notion. Can be a child of a page or database.', inputSchema: { type: 'object', properties: { parent: { type: 'object', properties: { type: { type: 'string', enum: ['page_id', 'database_id'], description: 'Type of parent' }, page_id: { type: 'string', description: 'ID of parent page (required if type is page_id)' }, database_id: { type: 'string', description: 'ID of parent database (required if type is database_id)' } }, required: ['type'], description: 'Parent page or database' }, properties: { type: 'object', description: 'Page properties. Must match parent database schema if parent is a database.' }, children: { type: 'array', description: 'Optional page content as array of block objects', items: { type: 'object' } }, 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: 'Optional page icon' }, 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: 'Optional page cover image' } }, required: ['parent', 'properties'] } };
- src/server.ts:52-75 (registration)Registration of the tool handler in the MCP server's CallToolRequestSchema handler via switch case.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; switch (name) { case 'notion_create_page': return handleCreatePageTool(this.client, args); case 'notion_retrieve_page': return handleRetrievePageTool(this.client, args); case 'notion_update_page': return handleUpdatePageTool(this.client, args); case 'notion_retrieve_page_property': return handleRetrievePagePropertyTool(this.client, args); default: throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${name}` ); } }); }
- src/server.ts:43-50 (registration)Registration of the tool definition in the MCP server's ListToolsRequestSchema handler.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ createPageToolDefinition, retrievePageToolDefinition, updatePageToolDefinition, retrievePagePropertyToolDefinition ], }));