list_databases
Retrieve a list of all databases available in the Mochow instance using Baidu Vector Database MCP Server, enabling efficient database management and operations for LLM applications.
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:475-485 (handler)The primary MCP tool handler for 'list_databases'. It uses the MochowConnector to fetch the list of databases and returns a formatted string listing them.@mcp.tool() 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)}"
- Supporting helper method in the MochowConnector class that interfaces with the pymochow client to retrieve and format the list of database 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:475-475 (registration)The @mcp.tool() decorator registers the list_databases function as an MCP tool.@mcp.tool()