describe_index
Retrieve detailed information about a specific index in a table within the Baidu Vector Database. Input the table and index name to access index configuration and structure.
Instructions
Describe index details in the Mochow instance.
Args:
table_name (str): Name of the table.
index_name (str): Name of the index to describe.
Returns:
str: A string containing the details of the index.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index_name | Yes | ||
| table_name | Yes |
Implementation Reference
- src/mochow_mcp_server/server.py:591-605 (handler)The handler function for the 'describe_index' MCP tool. It is registered via @mcp.tool() decorator and implements the tool logic by calling the connector's describe_index_info method and formatting the output.@mcp.tool() async def describe_index(table_name: str, index_name: str, ctx: Context = None) -> str: """ Describe index details in the Mochow instance. Args: table_name (str): Name of the table. index_name (str): Name of the index to describe. Returns: str: A string containing the details of the index. """ connector = ctx.request_context.lifespan_context.connector details = await connector.describe_index_info(table_name, index_name) return f"Index details named '{index_name}' for table named '{table_name}' in Mochow instance:\n{str(details)}"
- Supporting method in MochowConnector class that retrieves and returns the index information as a dictionary from the underlying database.async def describe_index_info(self, table_name: str, index_name: str) -> dict: """ Get detailed information about a index. Args: table_name (str): Name of the table. index_name (str): Name of the index. Returns: dict: A dictionary containing index details. """ if self.database is None: raise ValueError("Switch to the database before describe index") try: return self.database.table(table_name).describe_index(index_name).to_dict() except Exception as e: raise ValueError(f"Failed to get index detail info: {str(e)}")