create-database
Create a new database in Notion by specifying parent page, title, and property schema to organize information and structure content.
Instructions
Create a new database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parent_id | Yes | ID of the parent page | |
| title | Yes | Database title as rich text array | |
| properties | Yes | Database properties schema | |
| icon | No | Optional icon for the database | |
| cover | No | Optional cover for the database |
Implementation Reference
- server.js:425-462 (handler)Handler for the 'create-database' tool. Processes arguments, sanitizes parent_id, constructs database creation parameters, handles optional icon and cover with default emoji fallback, calls Notion API to create database, and returns the response as formatted JSON text.else if (name === "create-database") { let { parent_id, title, properties, icon, cover } = args; // Remove dashes if present in parent_id parent_id = parent_id.replace(/-/g, ""); const databaseParams = { parent: { type: "page_id", page_id: parent_id, }, title, properties, }; // Set default emoji if icon is specified but emoji is empty if (icon && icon.type === "emoji" && !icon.emoji) { icon.emoji = "📄"; // Default document emoji databaseParams.icon = icon; } else if (icon) { databaseParams.icon = icon; } if (cover) { databaseParams.cover = cover; } const response = await notion.databases.create(databaseParams); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; }
- server.js:130-155 (schema)Input schema definition for the 'create-database' tool, specifying required parent_id, title, properties, and optional icon/cover.inputSchema: { type: "object", properties: { parent_id: { type: "string", description: "ID of the parent page" }, title: { type: "array", description: "Database title as rich text array" }, properties: { type: "object", description: "Database properties schema" }, icon: { type: "object", description: "Optional icon for the database" }, cover: { type: "object", description: "Optional cover for the database" } }, required: ["parent_id", "title", "properties"] }
- server.js:127-156 (registration)Tool registration entry in the MCP server's tools list/array, defining name, description, and input schema for 'create-database'.{ name: "create-database", description: "Create a new database", inputSchema: { type: "object", properties: { parent_id: { type: "string", description: "ID of the parent page" }, title: { type: "array", description: "Database title as rich text array" }, properties: { type: "object", description: "Database properties schema" }, icon: { type: "object", description: "Optional icon for the database" }, cover: { type: "object", description: "Optional cover for the database" } }, required: ["parent_id", "title", "properties"] } },