deleteDatabase
Remove a CouchDB database by specifying its name via the CouchDB MCP Server, ensuring efficient management and cleanup of unused or outdated data.
Instructions
Delete a CouchDB database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dbName | Yes | Database name to delete |
Implementation Reference
- src/index.ts:309-335 (handler)The main handler function for the 'deleteDatabase' MCP tool. Validates the input arguments, calls the deleteDatabase helper function, and returns a formatted success or error 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, }; } }
- src/index.ts:76-89 (registration)Registration of the 'deleteDatabase' tool in the ListTools response, including name, description, and input schema definition.{ name: 'deleteDatabase', description: 'Delete a CouchDB database', inputSchema: { type: 'object', properties: { dbName: { type: 'string', description: 'Database name to delete', }, }, required: ['dbName'], }, },
- src/connection.ts:41-43 (helper)Helper function that performs the actual database deletion using Nano by destroying the database.export async function deleteDatabase(dbName: string): Promise<void> { await couch.db.destroy(dbName); }