couchdb_list_indexes
Retrieve all indexes in a CouchDB database to manage query performance and understand database structure for efficient document retrieval.
Instructions
List all indexes in a database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | Name of the database |
Implementation Reference
- couchdb_mcp_server.py:548-568 (handler)The _list_indexes handler method that implements the logic to list all indexes in a CouchDB database. It queries the _index endpoint and returns the indexes with metadata.async def _list_indexes(self, database: str) -> list[TextContent]: """List all indexes in a database.""" try: db = self._get_server()[database] # Get all indexes result = db.resource.get_json('_index') indexes = result[1].get("indexes", []) response = { "indexes": indexes, "count": len(indexes), "total_rows": result[1].get("total_rows") } return [TextContent(type="text", text=json.dumps(response, indent=2))] except KeyError: return [TextContent(type="text", text=f"Database '{database}' not found")] except Exception as e: return [TextContent(type="text", text=f"Error listing indexes: {str(e)}")]
- couchdb_mcp_server.py:246-259 (schema)Tool schema definition in list_tools() that defines the couchdb_list_indexes tool with its name, description, and input schema (requires 'database' parameter).Tool( name="couchdb_list_indexes", description="List all indexes in a database", inputSchema={ "type": "object", "properties": { "database": { "type": "string", "description": "Name of the database", }, }, "required": ["database"], }, ),
- couchdb_mcp_server.py:314-315 (registration)Tool registration routing in call_tool() that maps the couchdb_list_indexes tool name to its handler method.elif name == "couchdb_list_indexes": return await self._list_indexes(arguments["database"])