Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

drop_vector_index

Remove a vector index from a specified table in the Baidu Vector Database using the MCP server. Requires table and index names to execute.

Instructions

Drop the vector index in the Mochow instance. Args: table_name (str): Name of the table. index_name (str): Name of the vector index to drop. Returns: str: A message indicating the success of index drop.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
index_nameYes
table_nameYes

Implementation Reference

  • MCP tool handler for 'drop_vector_index'. It retrieves the connector from context, calls the helper method to drop the index, and returns a success message.
    @mcp.tool() async def drop_vector_index(table_name: str, index_name: str, ctx: Context = None) -> str: """ Drop the vector index in the Mochow instance. Args: table_name (str): Name of the table. index_name (str): Name of the vector index to drop. Returns: str: A message indicating the success of index drop. """ connector = ctx.request_context.lifespan_context.connector await connector.drop_vector_index(table_name, index_name) return f"Drop the vector index '{index_name}' successfully."
  • Helper method in MochowConnector class that implements the logic to drop a vector index: checks existence, drops if exists, handles errors.
    async def drop_vector_index(self, table_name: str, index_name: str) -> bool: """ Drop a vector index in a given table. Args: table_name (str): Name of the table. index_name (str): Name of the vector index. Returns: bool: True if the index is dropped successfully or does not exist, False otherwise. """ if self.database is None: raise ValueError("Switch to the database before drop vector index") # check vector index index_existed = True try: self.database.table(table_name).describe_index(index_name) except ServerError as e: if e.code == ServerErrCode.INDEX_NOT_EXIST: index_existed = False else: raise ValueError(f"Failed to get index detail: {str(e)}") # index already existed with same name if not index_existed: return True try: self.database.table(table_name).drop_index(index_name) return True except Exception as e: raise ValueError(f"Failed to drop vector index: {str(e)}")

Other Tools

Related 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