describe_table
Retrieve detailed information about a specific table in the Baidu Cloud Vector Database by specifying its name, enabling efficient data management and analysis within the MCP server environment.
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
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes |
Implementation Reference
- src/mochow_mcp_server/server.py:530-543 (handler)The handler function for the 'describe_table' MCP tool. It retrieves table details via the connector and formats them as a string response.@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 method in MochowConnector class that calls the underlying database.describe_table() and returns the info as dict. Called by the tool handler.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)}")
- src/mochow_mcp_server/server.py:530-530 (registration)The @mcp.tool() decorator registers the describe_table function as an MCP tool.@mcp.tool()