Skip to main content
Glama
andyfe76

CouchDB MCP Server

by andyfe76

couchdb_delete_document

Delete a document from a CouchDB database by specifying the database name, document ID, and revision number to remove data.

Instructions

Delete a document from a database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesName of the database
doc_idYesDocument ID
revYesDocument revision (_rev)

Implementation Reference

  • The actual handler implementation for deleting a document from CouchDB. Takes database name, document ID, and revision, then uses the CouchDB Python library's delete() method to remove the document. Handles various exceptions including database not found, document not found, and revision conflicts.
    async def _delete_document(self, database: str, doc_id: str, rev: str) -> list[TextContent]: """Delete a document.""" try: db = self._get_server()[database] db.delete({"_id": doc_id, "_rev": rev}) return [TextContent(type="text", text=f"Document '{doc_id}' deleted successfully")] except KeyError: return [TextContent(type="text", text=f"Database '{database}' not found")] except couchdb.http.ResourceNotFound: return [TextContent(type="text", text=f"Document '{doc_id}' not found")] except couchdb.http.ResourceConflict: return [TextContent(type="text", text="Document delete conflict - revision mismatch")]
  • Tool schema definition for couchdb_delete_document. Defines the tool's name, description, and input schema with required parameters: database (string), doc_id (string), and rev (string for document revision).
    Tool( name="couchdb_delete_document", description="Delete a document from a database", inputSchema={ "type": "object", "properties": { "database": { "type": "string", "description": "Name of the database", }, "doc_id": { "type": "string", "description": "Document ID", }, "rev": { "type": "string", "description": "Document revision (_rev)", }, }, "required": ["database", "doc_id", "rev"], }, ),
  • Registration point where the couchdb_delete_document tool name is routed to its handler method. Extracts the three required arguments (database, doc_id, rev) and calls the _delete_document async method.
    elif name == "couchdb_delete_document": return await self._delete_document( arguments["database"], arguments["doc_id"], arguments["rev"] )

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