Skip to main content
Glama
andyfe76

CouchDB MCP Server

by andyfe76

couchdb_get_document

Retrieve a specific document from a CouchDB database using its document ID. This tool fetches stored data for viewing or processing within the CouchDB MCP Server environment.

Instructions

Retrieve a document from a database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesName of the database
doc_idYesDocument ID

Implementation Reference

  • The _get_document handler method that implements the core logic for retrieving a document from CouchDB. It gets the database, retrieves the document by ID, and returns it as JSON with proper error handling for missing databases or documents.
    async def _get_document(self, database: str, doc_id: str) -> list[TextContent]:
        """Retrieve a document."""
        try:
            db = self._get_server()[database]
            doc = db[doc_id]
            return [TextContent(type="text", text=json.dumps(doc, indent=2))]
        except KeyError:
            return [TextContent(type="text", text=f"Database '{database}' or document '{doc_id}' not found")]
        except couchdb.http.ResourceNotFound:
            return [TextContent(type="text", text=f"Document '{doc_id}' not found")]
  • Registration mapping in the call_tool handler that routes the 'couchdb_get_document' tool name to its handler method, extracting the database and doc_id arguments.
    elif name == "couchdb_get_document":
        return await self._get_document(
            arguments["database"],
            arguments["doc_id"]
        )
  • Tool schema definition for couchdb_get_document, specifying it requires 'database' and 'doc_id' parameters, both as strings, with descriptions for each.
    Tool(
        name="couchdb_get_document",
        description="Retrieve a document from a database",
        inputSchema={
            "type": "object",
            "properties": {
                "database": {
                    "type": "string",
                    "description": "Name of the database",
                },
                "doc_id": {
                    "type": "string",
                    "description": "Document ID",
                },
            },
            "required": ["database", "doc_id"],
        },
    ),
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the operation is a retrieval, implying read-only behavior, but doesn't disclose error conditions (e.g., missing database/document), authentication needs, rate limits, or return format. For a tool with no annotations, this leaves significant behavioral gaps.

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, clear sentence with zero waste. It's appropriately sized for a simple retrieval tool and front-loads the core action, making it easy to understand at a glance without unnecessary elaboration.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what a 'document' returns (e.g., JSON object with _id, _rev), error handling, or how it differs from sibling tools. For a retrieval tool in a set with multiple document-related operations, more context is needed to guide proper use.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('database' and 'doc_id') adequately. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints, which aligns with the baseline score when schema coverage is high.

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

Purpose3/5

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

The description states the action ('retrieve') and resource ('a document from a database'), which clarifies the basic purpose. However, it lacks specificity about what a 'document' entails in CouchDB context and doesn't differentiate from sibling tools like 'couchdb_list_documents' or 'couchdb_search_documents' that also retrieve documents in different ways.

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?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention that this retrieves a single document by ID, unlike 'couchdb_list_documents' (lists multiple) or 'couchdb_search_documents' (searches by criteria), nor does it specify prerequisites like database existence.

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/andyfe76/couchdb_mcp'

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