update_database
Modify Notion database structure by updating its title or schema properties, including adding, changing, or removing columns and property definitions.
Instructions
Updates the database itself (not individual records). Can change database title or update schema (add/modify/delete properties/columns). Note: To update individual records, use update_page instead.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| databaseId | Yes | The ID of the Notion database to update (32 or 36 character UUID format). Example: "123e4567-e89b-12d3-a456-426614174000" | |
| title | No | New title for the database (optional). Example: "Task Management 2024" | |
| schema | No | Database schema (property definitions) to update (optional). Use property names as keys and property definitions as values. Example (adding a new property): { "Priority": { "select": { "options": [ { "name": "High", "color": "red" }, { "name": "Medium", "color": "yellow" }, { "name": "Low", "color": "gray" } ] } } } |
Implementation Reference
- MCP server handler method for the 'update_database' tool. Parses arguments, calls the UpdateDatabaseUseCase, and returns formatted response.private async handleUpdateDatabase(args: any) { const result = await this.dependencies.updateDatabaseUseCase.execute({ databaseId: args.databaseId, title: args.title, schema: args.schema, }); return { content: [ { type: 'text' as const, text: JSON.stringify( { id: result.id.toString(), title: result.title, schema: result.schema, lastEditedTime: result.lastEditedTime, }, null, 2 ), }, ], }; }
- Core use case implementing the business logic for updating a Notion database's title or schema via the repository.export class UpdateDatabaseUseCase { constructor(private readonly databaseRepository: IDatabaseRepository) {} async execute(input: UpdateDatabaseInput): Promise<Database> { const databaseId = new DatabaseId(input.databaseId); return await this.databaseRepository.update(databaseId, { title: input.title, schema: input.schema, }); } }
- src/presentation/mcp/MCPServer.ts:281-315 (registration)MCP tool registration object defining 'update_database' tool with name, detailed description, and input schema.{ name: 'update_database', description: 'Updates the database itself (not individual records). Can change database title or update schema (add/modify/delete properties/columns). Note: To update individual records, use update_page instead.', inputSchema: { type: 'object', properties: { databaseId: { type: 'string', description: 'The ID of the Notion database to update (32 or 36 character UUID format). Example: "123e4567-e89b-12d3-a456-426614174000"', }, title: { type: 'string', description: 'New title for the database (optional). Example: "Task Management 2024"', }, schema: { type: 'object', description: `Database schema (property definitions) to update (optional). Use property names as keys and property definitions as values. Example (adding a new property): { "Priority": { "select": { "options": [ { "name": "High", "color": "red" }, { "name": "Medium", "color": "yellow" }, { "name": "Low", "color": "gray" } ] } } }`, }, }, required: ['databaseId'], }, },
- TypeScript interface defining the input structure for the UpdateDatabaseUseCase, matching the tool's input schema.export interface UpdateDatabaseInput { databaseId: string; title?: string; schema?: Partial<DatabaseSchema>; }