Skip to main content
Glama
robertoamoreno

CouchDB MCP Server

createDatabase

Create a new CouchDB database by specifying a database name. This tool enables AI assistants to set up databases for storing and managing documents.

Instructions

Create a new CouchDB database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dbNameYesDatabase name

Implementation Reference

  • The handler function for the 'createDatabase' tool. Validates the input dbName and calls the getDatabase helper to create the database if it does not exist, returning a formatted success or error response.
    private async handleCreateDatabase(args: any) {
      if (!args.dbName || typeof args.dbName !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid database name');
      }
    
      try {
        await getDatabase(args.dbName);
        return {
          content: [
            {
              type: 'text',
              text: `Database ${args.dbName} created successfully`,
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error creating database: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the 'createDatabase' tool, requiring a 'dbName' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        dbName: {
          type: 'string',
          description: 'Database name',
        },
      },
      required: ['dbName'],
    },
  • src/index.ts:54-67 (registration)
    Registration of the 'createDatabase' tool in the ListToolsRequestSchema handler, providing name, description, and schema.
    {
      name: 'createDatabase',
      description: 'Create a new CouchDB database',
      inputSchema: {
        type: 'object',
        properties: {
          dbName: {
            type: 'string',
            description: 'Database name',
          },
        },
        required: ['dbName'],
      },
    },
  • src/index.ts:230-231 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement, routing 'createDatabase' calls to the handler.
    case 'createDatabase':
      return this.handleCreateDatabase(request.params.arguments);
  • Helper function that gets an existing CouchDB database or creates it if not found (404), then returns the DocumentScope. This performs the core logic for database creation.
    export async function getDatabase(dbName: string): Promise<DocumentScope<any>> {
      try {
        await couch.db.get(dbName);
      } catch (error: any) {
        if (error.statusCode === 404) {
          await couch.db.create(dbName);
        } else {
          throw error;
        }
      }
      return couch.use(dbName);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a database but lacks critical details: it doesn't specify if this requires admin privileges, what happens if the database already exists (e.g., error or overwrite), or any rate limits or side effects. This leaves significant gaps for an agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly, though it could benefit from more detail given the lack of annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a database creation tool with no annotations and no output schema, the description is insufficient. It doesn't cover behavioral aspects like permissions, error handling, or what the tool returns upon success. For a mutation tool with zero annotation coverage, more completeness is needed to guide an agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with 'dbName' documented as 'Database name'. The description adds no additional meaning beyond this, such as naming conventions, length restrictions, or character constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, but the description doesn't compensate with extra context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('a new CouchDB database'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'createDocument' or 'listDatabases', which would require more specificity about what distinguishes database creation from document creation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'createDocument' or 'deleteDatabase'. There's no mention of prerequisites, such as needing admin permissions or checking if a database already exists, nor any explicit exclusions or recommended contexts for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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