create_page
Generate a new page in Notion with customizable properties, optional content blocks, and settings for icons or cover images using JSON schema inputs.
Instructions
Create a new page in Notion
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| children | No | Optional array of paragraph blocks to add as page content | |
| cover | No | Optional cover image for the page | |
| icon | No | Optional icon for the page | |
| parent | No | Optional parent - if not provided, will use NOTION_PAGE_ID as parent page | |
| properties | Yes | Properties of the page |
Implementation Reference
- src/tools/createPage.ts:6-23 (handler)The core handler function that implements the 'create_page' tool logic. It invokes the Notion API to create a new page with the given parameters and returns a success message with the page ID or handles errors.export const registerCreatePageTool = async ( params: CreatePageParams ): Promise<CallToolResult> => { try { const response = await notion.pages.create(params); return { content: [ { type: "text", text: `Page created successfully: ${response.id}`, }, ], }; } catch (error) { return handleNotionError(error); } };
- src/schema/page.ts:48-90 (schema)Defines the Zod schema (CREATE_PAGE_SCHEMA) used for validating input parameters to the create_page operation, including parent, properties, children, icon, and cover.export const CREATE_PAGE_SCHEMA = { parent: PARENT_SCHEMA.optional() .default({ type: "page_id", page_id: getRootPageId(), }) .describe( "Optional parent - if not provided, will use NOTION_PAGE_ID as parent page" ), properties: z .record( z.string().describe("Property name"), z.union([ TITLE_PROPERTY_SCHEMA, CHECKBOX_PROPERTY_VALUE_SCHEMA, EMAIL_PROPERTY_VALUE_SCHEMA, STATUS_PROPERTY_VALUE_SCHEMA, FILES_PROPERTY_VALUE_SCHEMA, DATE_PROPERTY_VALUE_SCHEMA, PEOPLE_PROPERTY_VALUE_SCHEMA, PHONE_NUMBER_PROPERTY_VALUE_SCHEMA, RELATION_PROPERTY_VALUE_SCHEMA, RICH_TEXT_PROPERTY_VALUE_SCHEMA, SELECT_PROPERTY_VALUE_SCHEMA, NUMBER_PROPERTY_VALUE_SCHEMA, ]) ) .describe("Properties of the page"), children: z .array(TEXT_BLOCK_REQUEST_SCHEMA) .optional() .describe("Optional array of paragraph blocks to add as page content"), icon: z.preprocess( preprocessJson, ICON_SCHEMA.nullable().optional().describe("Optional icon for the page") ), cover: z.preprocess( preprocessJson, FILE_SCHEMA.nullable() .optional() .describe("Optional cover image for the page") ), };
- src/tools/index.ts:16-20 (registration)Registers the 'notion_pages' MCP tool, which encompasses the 'create_page' action (along with others) using PAGES_OPERATION_SCHEMA and the dispatcher handler."notion_pages", "Perform various page operations (create, archive, restore, search, update)", PAGES_OPERATION_SCHEMA, registerPagesOperationTool );
- src/tools/pages.ts:14-15 (helper)Dispatcher logic in the 'notion_pages' tool handler that routes 'create_page' action calls to the specific registerCreatePageTool implementation.case "create_page": return registerCreatePageTool(params.payload.params);
- src/schema/page.ts:148-152 (schema)Part of PAGES_OPERATION_SCHEMA discriminated union defining the structure for 'create_page' action including its literal discriminator and params schema.action: z .literal("create_page") .describe("Use this action to create a new page in the database."), params: z.object(CREATE_PAGE_SCHEMA), }),