Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

list_tables

Retrieve names of all tables in the Baidu Vector Database to manage or query data efficiently. Returns a string listing table names for easy reference.

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

  • MCP tool handler for 'list_tables'. Retrieves the list of tables from the current database using the MochowConnector and formats the response as a string.
    @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 by calling self.database.list_table() and extracting 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()

Other Tools

Related Tools

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