Skip to main content
Glama
create-page.js4.1 kB
export const createPageToolDefinition = { 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'] } }; export async function handleCreatePageTool(client, args) { try { const createArgs = { 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) { return { content: [ { type: 'text', text: `Error creating page: ${error.message || 'Unknown error'}` } ], isError: true }; } } export const createPageTool = { definition: createPageToolDefinition, handler: handleCreatePageTool };

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