deleteDatabase
Remove a CouchDB database by specifying its name to free up storage space or clean up unused data.
Instructions
Delete a CouchDB database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dbName | Yes | Database name to delete |
Implementation Reference
- src/connection.ts:41-43 (handler)Core handler function that performs the database deletion using CouchDB Nano client's destroy method.export async function deleteDatabase(dbName: string): Promise<void> { await couch.db.destroy(dbName); }
- src/index.ts:76-89 (schema)Input schema for the deleteDatabase tool, defining the required dbName parameter.{ name: 'deleteDatabase', description: 'Delete a CouchDB database', inputSchema: { type: 'object', properties: { dbName: { type: 'string', description: 'Database name to delete', }, }, required: ['dbName'], }, },
- src/index.ts:234-235 (registration)Registration of the tool in the CallToolRequestSchema switch dispatcher.case 'deleteDatabase': return this.handleDeleteDatabase(request.params.arguments);
- src/index.ts:309-335 (helper)Wrapper handler method that validates input, calls the core deleteDatabase function, and formats the MCP response.private async handleDeleteDatabase(args: any) { if (!args.dbName || typeof args.dbName !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid database name'); } try { await deleteDatabase(args.dbName); return { content: [ { type: 'text', text: `Database ${args.dbName} deleted successfully`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error deleting database: ${error.message}`, }, ], isError: true, }; } }