Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

describe_index

Retrieve detailed information about a specific index in a Baidu Vector Database table to understand its structure and configuration.

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
NameRequiredDescriptionDefault
table_nameYes
index_nameYes

Implementation Reference

  • The main execution logic for the 'describe_index' tool, decorated with @mcp.tool() which also serves as registration. It retrieves index details via the connector and formats the response.
    @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)}"
  • Helper method in MochowConnector class that fetches and returns the index information as a dictionary from the 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)}")

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