Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

rebuild_vector_index

Rebuild a vector index in Baidu Vector Database to optimize search performance and maintain data integrity for AI applications.

Instructions

Rebuild the vector index in the Mochow instance.

Args:
    table_name (str): Name of the table.
    index_name (str): Name of the vector index to rebuild.

Returns:
    str: A message indicating the success of index rebuild initiation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes
index_nameYes

Implementation Reference

  • MCP tool handler function for 'rebuild_vector_index', decorated with @mcp.tool() for registration, delegates to MochowConnector.rebuild_vector_index
    @mcp.tool()
    async def rebuild_vector_index(table_name: str, index_name: str, ctx: Context = None) -> str:
        """
        Rebuild the vector index in the Mochow instance.
    
        Args:
            table_name (str): Name of the table.
            index_name (str): Name of the vector index to rebuild.
    
        Returns:
            str: A message indicating the success of index rebuild initiation.
        """
        connector = ctx.request_context.lifespan_context.connector
        await connector.rebuild_vector_index(table_name, index_name)
        return f"Initiate the rebuild of vector index '{index_name}' successfully."
  • Core helper method in MochowConnector class that implements the vector index rebuild logic by calling the Mochow database API.
    async def rebuild_vector_index(self, table_name: str, index_name: str) -> bool:
        """
        Rebuild 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 rebuilt successfully, False otherwise.
        """
        if self.database is None:
            raise ValueError("Switch to the database before rebuild 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:
            raise ValueError(f"Vector index not existed with name '{index_name}'")
    
        try:
            self.database.table(table_name).rebuild_index(index_name)
            return True
        except Exception as e:
            raise ValueError(f"Failed to rebuild vector index: {str(e)}")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks behavioral details. It mentions 'initiation' in the return, hinting at an asynchronous operation, but doesn't clarify if this is destructive to existing data, requires specific permissions, has performance impacts, or involves rate limits. More context on these aspects is needed for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The Args and Returns sections are structured but could be more integrated; however, there's no wasted text, making it efficient overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a mutation tool with no annotations, 0% schema coverage, and no output schema, the description is incomplete. It doesn't explain the implications of rebuilding (e.g., downtime, data integrity), error conditions, or detailed return values beyond a success message. More context is needed for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, but it only lists parameter names without adding meaning beyond the schema's titles. The Args section repeats what's in the input schema without explaining what 'table_name' or 'index_name' refer to (e.g., existing tables/indexes). Baseline is 3 due to low coverage but minimal added value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Rebuild') and target ('vector index in the Mochow instance'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'drop_vector_index' or 'create_vector_index' which might be alternatives for index management, leaving room for improvement.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'drop_vector_index' followed by 'create_vector_index', or whether prerequisites such as existing indexes or specific database states are required. The description only states what it does, not when it should be used.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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