Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

delete_table_rows

Remove specific rows from a Baidu Vector Database table using filter expressions to delete targeted data 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
table_nameYes
filter_exprYes

Implementation Reference

  • MCP tool handler for 'delete_table_rows' that deletes rows from a specified table using a filter expression by calling the connector'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."
  • Helper method in MochowConnector class that executes the actual row deletion using 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}")
  • Registration of the 'delete_table_rows' tool using the @mcp.tool() decorator.
    @mcp.tool()

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