Skip to main content
Glama
robertoamoreno

CouchDB MCP Server

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
NameRequiredDescriptionDefault
dbNameYesDatabase name to delete

Implementation Reference

  • 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);
    }
  • 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);
  • 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,
        };
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/robertoamoreno/couchdb-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server