Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

delete_table_rows

Remove specific rows from a table in Baidu Vector Database using a filter expression. Streamlines data management by targeting deletions based on defined criteria.

Instructions

Delete rows with a filter expression in the Mochow instance. Args: table_name (str): Name of the table. filter_expr (str): Filter expression to select data to delete. Returns: str: A message indicating the success of data deletion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filter_exprYes
table_nameYes

Implementation Reference

  • The main handler function for the 'delete_table_rows' MCP tool. It is registered via @mcp.tool() decorator and delegates to the MochowConnector's delete_rows method.
    @mcp.tool() async def delete_table_rows(table_name: str, filter_expr: str, ctx: Context = None) -> str: """ Delete rows with a filter expression in the Mochow instance. Args: table_name (str): Name of the table. filter_expr (str): Filter expression to select data to delete. Returns: str: A message indicating the success of data deletion. """ connector = ctx.request_context.lifespan_context.connector await connector.delete_rows(table_name, filter_expr) return f"Delete rows with filter expression '{filter_expr}' successfully."
  • Supporting helper method in MochowConnector class that executes the actual deletion call to the Mochow database API.
    async def delete_rows(self, table_name: str, filter_expr: str) -> bool: """ Delete rows in a given table using a filter expression. Args: table_name (str): Name of the table. filter_expr (str): Filter expression to select data to delete. Returns: bool: True if the rows is deleted successfully, False otherwise. """ if self.database is None: raise ValueError("Switch to the database before delete rows with filter expression.") try: self.database.table(table_name).delete(filter=filter_expr) return True except Exception as e: raise ValueError(f"Failed to delete data with filter expression: {filter_expr}")

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