Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

stats_table

Retrieve table statistics from the Baidu Vector Database to analyze data structure and optimize vector search performance.

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 retrieves table statistics via the MochowConnector and formats them into a readable string output.
    @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 MochowConnector class that calls the Mochow API to fetch raw table statistics, used by the stats_table 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)}")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that it returns 'a string containing the table statistics', which gives some output information, but doesn't cover important aspects like whether this is a read-only operation, potential performance impacts, error conditions, or what specific statistics are included.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by Args and Returns sections. Every sentence serves a purpose, though the 'Returns' section could be more specific about what 'table statistics' actually means.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no annotations and no output schema, the description provides basic functionality and parameter documentation. However, it lacks important context about what 'table statistics' includes, how this differs from other table inspection tools, and any behavioral constraints or requirements.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description explicitly documents the single parameter 'table_name' with its type and purpose, which is valuable since schema description coverage is 0%. However, it doesn't provide additional context like valid table name formats, examples, or constraints beyond what's minimally stated.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('table statistics'), making the purpose understandable. However, it doesn't differentiate this tool from potential siblings like 'describe_table' or 'select_table_rows', which might also provide table information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'describe_table' or 'select_table_rows'. The description only states what it does, not when it should be chosen over other table-related tools in the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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