notion_create_page
Create a new page as a child of an existing page or database in Notion, with support for structured content blocks and properties.
Instructions
Create a page as child of page or database. LIMITS: 100 blocks, 2 nesting levels, 2000 chars.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parent | Yes | Parent of the page. Specify either page_id (to create a subpage) or database_id (to create a database item). | |
| properties | Yes | Page properties. For pages with a page parent, use 'title' property. For database items, match the database schema. | |
| children | No | Page content as an array of block objects. | |
| format | No | Specify the response format. 'json' returns the original data structure, 'markdown' returns a more readable format. Use 'markdown' when the user only needs to read the page and isn't planning to write or modify it. Use 'json' when the user needs to read the page with the intention of writing to or modifying it. | markdown |
Implementation Reference
- src/server/index.ts:114-126 (handler)The handler that processes the notion_create_page tool request. It validates required arguments (parent and properties), extracts the CreatePageArgs from the request, and calls notionClient.createPage() with the parent, properties, and optional children.case "notion_create_page": { const pageArgs = request.params .arguments as unknown as args.CreatePageArgs; if (!pageArgs.parent || !pageArgs.properties) { throw new Error("Missing required arguments: parent and properties"); } response = await notionClient.createPage( pageArgs.parent, pageArgs.properties, pageArgs.children ); break; }
- src/types/schemas.ts:122-155 (schema)The tool schema definition for notion_create_page, including its name, description with limits (100 blocks, 2 nesting levels, 2000 chars), input schema with parent (page_id or database_id), properties, children (array of block objects), and format parameters.export const createPageTool: Tool = { name: "notion_create_page", description: "Create a page as child of page or database. **LIMITS:** 100 blocks, 2 nesting levels, 2000 chars.", inputSchema: { type: "object", properties: { parent: { type: "object", description: "Parent of the page. Specify either page_id (to create a subpage) or database_id (to create a database item).", properties: { page_id: { type: "string", description: "The ID of the parent page." + commonIdDescription, }, database_id: { type: "string", description: "The ID of the parent database." + commonIdDescription, }, }, }, properties: { type: "object", description: "Page properties. For pages with a page parent, use 'title' property. For database items, match the database schema.", }, children: { type: "array", description: "Page content as an array of block objects.", items: blockObjectSchema, }, format: formatParameter, }, required: ["parent", "properties"], }, };
- src/client/index.ts:48-65 (handler)The NotionClientWrapper.createPage method that implements the actual API call to Notion's /pages endpoint. It constructs the request body with parent, properties, and optional children, then makes a POST request to create the page.async createPage( parent: { database_id?: string; page_id?: string }, properties: Record<string, any>, children?: Partial<BlockResponse>[] ): Promise<PageResponse> { const body: Record<string, any> = { parent, properties }; if (children && children.length > 0) { body.children = children; } const response = await fetch(`${this.baseUrl}/pages`, { method: "POST", headers: this.headers, body: JSON.stringify(body), }); return this.handleResponse<PageResponse>(response); }
- src/types/args.ts:39-44 (schema)TypeScript interface defining the CreatePageArgs type used for type-safe argument handling, including parent (with optional database_id or page_id), properties as a generic record, optional children array, and optional format string.export interface CreatePageArgs { parent: { database_id?: string; page_id?: string }; properties: Record<string, any>; children?: Partial<BlockResponse>[]; format?: "json" | "markdown"; }