Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

list_tables

Retrieve all table names from the Baidu Vector Database to view available data collections for vector search operations.

Instructions

List all tables in the current database. Returns: str: A string containing the names of all tables.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'list_tables', decorated with @mcp.tool(). It retrieves the list of tables from the MochowConnector and formats them into a string response.
    @mcp.tool() async def list_tables(ctx: Context) -> str: """ List all tables in the current database. Returns: str: A string containing the names of all tables. """ connector = ctx.request_context.lifespan_context.connector tables = await connector.list_tables() return f"Tables in database:\n{', '.join(tables)}"
  • Helper method in MochowConnector class that lists all tables in the current database using the Mochow database client and returns a list of table names.
    async def list_tables(self) -> list[str]: """ List all tables in the current database. Returns: list[str]: A list of table names. """ if self.database is None: raise ValueError("Switch to the database before list tables") try: tables = self.database.list_table() return [table.table_name for table in tables] except Exception as e: raise ValueError(f"Failed to list tables: {str(e)}")
  • The @mcp.tool() decorator registers the list_tables function as an MCP tool.
    @mcp.tool()

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/baidu/mochow-mcp-server-python'

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