list_databases
Retrieve all database names from the Baidu Vector Database MCP Server instance to view available data collections for vector search operations.
Instructions
List all databases in the Mochow instance.
Returns:
str: A string containing the names of all databases.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mochow_mcp_server/server.py:476-485 (handler)The MCP tool handler for 'list_databases'. It retrieves the list of databases from the MochowConnector and returns a formatted string listing them.async def list_databases(ctx: Context = None) -> str: """ List all databases in the Mochow instance. Returns: str: A string containing the names of all databases. """ connector = ctx.request_context.lifespan_context.connector databases = await connector.list_databases() return f"Databases in Mochow instance:\n{', '.join(databases)}"
- Helper method in the MochowConnector class that calls the underlying MochowClient to list databases and extracts their names.async def list_databases(self) -> list[str]: """ List all databases in the Mochow instance. Returns: list[str]: A list of database names. """ try: databases = self.client.list_databases() return [database.database_name for database in databases] except Exception as e: raise ValueError(f"Failed to list databases: {str(e)}")
- src/mochow_mcp_server/server.py:476-476 (registration)The @mcp.tool() decorator registers the list_databases function as an MCP tool.async def list_databases(ctx: Context = None) -> str: