Skip to main content
Glama

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
NameRequiredDescriptionDefault
childrenNoOptional array of paragraph blocks to add as page content
coverNoOptional cover image for the page
iconNoOptional icon for the page
parentNoOptional parent - if not provided, will use NOTION_PAGE_ID as parent page
propertiesYesProperties of the page

Implementation Reference

  • 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); } };
  • 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") ), };
  • 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 );
  • 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);
  • 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), }),

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/awkoy/notion-mcp-server'

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