Skip to main content
Glama

create-database

Generate structured databases in Notion by specifying a parent page ID, title, and properties to organize and manage data effectively within your workspace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parentPageIdYes
propertiesYes
titleYes

Implementation Reference

  • The handler function that creates a new Notion database under the specified parent page using the Notion client. It takes parentPageId, title, and properties as input and returns success/error messages.
    async ({ parentPageId, title, properties }) => { try { const response = await notion.databases.create({ parent: { type: "page_id", page_id: parentPageId }, title: [ { type: "text", text: { content: title } } ], properties: properties }); return { content: [{ type: "text", text: `Database created successfully!\nTitle: ${title}\nID: ${response.id}` }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error creating database: ${error.message}` }], isError: true }; } }
  • Zod schema defining the input parameters for the create-database tool: parentPageId (string), title (string), and properties (record of any).
    { parentPageId: z.string(), title: z.string(), properties: z.record(z.any()) },
  • src/index.ts:281-322 (registration)
    Registration of the 'create-database' tool on the MCP server using server.tool(), including schema and handler.
    server.tool( "create-database", { parentPageId: z.string(), title: z.string(), properties: z.record(z.any()) }, async ({ parentPageId, title, properties }) => { try { const response = await notion.databases.create({ parent: { type: "page_id", page_id: parentPageId }, title: [ { type: "text", text: { content: title } } ], properties: properties }); return { content: [{ type: "text", text: `Database created successfully!\nTitle: ${title}\nID: ${response.id}` }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error creating database: ${error.message}` }], isError: true }; } } );

Other Tools

Related Tools

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

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