get_database
Retrieve detailed information about a Notion database including title, schema, property definitions, creation time, and last edited time using the database ID.
Instructions
Retrieves detailed information about a specific Notion database by its ID. Returns database title, schema (property definitions), creation time, last edited time, and more. Use this to understand database structure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| databaseId | Yes | The ID of the Notion database to retrieve (32 or 36 character UUID format). Example: "123e4567-e89b-12d3-a456-426614174000" |
Input Schema (JSON Schema)
{
"properties": {
"databaseId": {
"description": "The ID of the Notion database to retrieve (32 or 36 character UUID format). Example: \"123e4567-e89b-12d3-a456-426614174000\"",
"type": "string"
}
},
"required": [
"databaseId"
],
"type": "object"
}
Implementation Reference
- Primary MCP tool handler for 'get_database'. Invokes the GetDatabaseUseCase with the provided databaseId, handles null result, and formats the response as MCP content.private async handleGetDatabase(args: any) { const result = await this.dependencies.getDatabaseUseCase.execute({ databaseId: args.databaseId, }); if (!result) { return { content: [ { type: 'text' as const, text: 'Database not found', }, ], }; } return { content: [ { type: 'text' as const, text: JSON.stringify( { id: result.id.toString(), title: result.title, schema: result.schema, createdTime: result.createdTime, lastEditedTime: result.lastEditedTime, archived: result.archived, }, null, 2 ), }, ], }; }
- src/presentation/mcp/MCPServer.ts:259-272 (registration)Registers the 'get_database' tool with the MCP server, including its name, description, and input schema definition.{ name: 'get_database', description: 'Retrieves detailed information about a specific Notion database by its ID. Returns database title, schema (property definitions), creation time, last edited time, and more. Use this to understand database structure.', inputSchema: { type: 'object', properties: { databaseId: { type: 'string', description: 'The ID of the Notion database to retrieve (32 or 36 character UUID format). Example: "123e4567-e89b-12d3-a456-426614174000"', }, }, required: ['databaseId'], }, },
- Core business logic for retrieving a database by ID. Creates a DatabaseId value object and delegates to the database repository.export class GetDatabaseUseCase { constructor(private readonly databaseRepository: IDatabaseRepository) {} async execute(input: GetDatabaseInput): Promise<Database | null> { const databaseId = new DatabaseId(input.databaseId); return await this.databaseRepository.findById(databaseId); } }
- Type definition for the input to the GetDatabaseUseCase.export interface GetDatabaseInput { databaseId: string; }