Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

stats_table

Retrieve detailed statistics for a specified table in the Baidu Vector Database using the MCP server, enabling data analysis and management for LLM applications.

Instructions

Get the table statistics in the Mochow instance. Args: table_name (str): Name of the table to get statistics. Returns: str: A string containing the table statistics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes

Implementation Reference

  • The handler function for the 'stats_table' MCP tool. It is registered via @mcp.tool() decorator. Retrieves table statistics via the MochowConnector and formats the output as a string with row count, memory size, and disk size.
    @mcp.tool() async def stats_table(table_name: str, ctx: Context = None) -> str: """ Get the table statistics in the Mochow instance. Args: table_name (str): Name of the table to get statistics. Returns: str: A string containing the table statistics. """ connector = ctx.request_context.lifespan_context.connector stats = await connector.get_table_statistics(table_name) output = f"Table statistics named '{table_name}' in Mochow instance:\n" output += f"TotalRowCount: {str(stats.row_count)}\n" output += f"MemorySizeInByte: {str(stats.memory_size_in_byte)}\n" output += f"DiskSizeInByte: {str(stats.disk_size_in_byte)}\n" return output
  • Supporting helper method in the MochowConnector class that calls the Mochow API to get raw table statistics (row_count, memory_size_in_byte, disk_size_in_byte). Used by the stats_table tool handler.
    async def get_table_statistics(self, table_name: str) -> HttpResponse: """ Get statistics information about a table. Args: table_name (str): Name of the table. Returns: HttpResponse: The HTTP response containing the table statistics. """ if self.database is None: raise ValueError("Switch to the database before get table statistics") try: return self.database.table(table_name).stats() except Exception as e: raise ValueError(f"Failed to get table statistics: {str(e)}")

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