create-database
Create a new Notion database with a specified title, properties, and optional icon or cover. Assign it to a parent page for organized workspace management.
Instructions
Create a new database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cover | No | Optional cover for the database | |
| icon | No | Optional icon for the database | |
| parent_id | Yes | ID of the parent page | |
| properties | Yes | Database properties schema | |
| title | Yes | Database title as rich text array |
Implementation Reference
- server.js:423-460 (handler)Handler implementation for the 'create-database' tool that creates a new Notion database using the notion.databases.create API.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:128-153 (schema)Input schema definition for the 'create-database' tool, specifying parameters like parent_id, title, properties, icon, and 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:125-154 (registration)Registration of the 'create-database' tool in the tools/list endpoint response, providing name, description, and input schema.{ 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"] } },