Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

describe_table

Retrieve table structure and details from Baidu Vector Database to understand schema, fields, and configuration for data operations.

Instructions

Describe table details in the Mochow instance.

Args:
    table_name (str): Name of the table to describe.

Returns:
    str: A string containing the details of the table.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes

Implementation Reference

  • The primary handler function for the 'describe_table' MCP tool. Decorated with @mcp.tool() for automatic registration. It fetches table details using the connector's describe_table_info method and returns a formatted string description.
    @mcp.tool()
    async def describe_table(table_name: str, ctx: Context = None) -> str:
        """
        Describe table details in the Mochow instance.
    
        Args:
            table_name (str): Name of the table to describe.
    
        Returns:
            str: A string containing the details of the table.
        """
        connector = ctx.request_context.lifespan_context.connector
        details = await connector.describe_table_info(table_name)
        return f"Table details named '{table_name}' in Mochow instance:\n{str(details)}"
  • Supporting helper method in the MochowConnector class that interfaces with the underlying pymochow database to retrieve and return table schema/details as a dictionary.
    async def describe_table_info(self, table_name: str) -> dict:
        """
        Get detailed information about a table.
    
        Args:
            table_name (str): Name of the table.
    
        Returns:
            dict: A dictionary containing table details.
        """
        if self.database is None:
            raise ValueError("Switch to the database before describe table")
        try:
            return self.database.describe_table(table_name).to_dict()
        except Exception as e:
            raise ValueError(f"Failed to get table detail info: {str(e)}")
  • The @mcp.tool() decorator on the describe_table function registers it as an MCP tool with FastMCP.
    @mcp.tool()
  • Input schema defined by function signature (table_name: str) and docstring; output is str.
    async def describe_table(table_name: str, ctx: Context = None) -> str:
        """
        Describe table details in the Mochow instance.
    
        Args:
            table_name (str): Name of the table to describe.
    
        Returns:
            str: A string containing the details of the table.

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