tables_db_delete_rows
Delete multiple rows from an Appwrite database table using queries. Remove all rows if no queries are specified, with support for bulk operations and transaction staging.
Instructions
Bulk delete rows using queries, if no queries are passed then all rows are deleted.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database_id | Yes | Database ID. | |
| table_id | Yes | Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | |
| queries | No | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | |
| transaction_id | No | Transaction ID for staging the operation. |
Implementation Reference
- src/mcp_server_appwrite/server.py:71-71 (registration)Registers the TablesDB service with name 'tables_db'. This service dynamically generates MCP tools for each public method on TablesDB(client), prefixed with 'tables_db_', including 'tables_db_delete_rows'.tools_manager.register_service(Service(TablesDB(client), "tables_db"))
- src/mcp_server_appwrite/service.py:88-88 (registration)Dynamically sets the tool name to '{service_name}_{method_name}' (e.g., 'tables_db_delete_rows' for TablesDB.delete_rows method). No overrides defined, so uses default prefixing.tool_name = self._method_name_overrides.get(name, f"{self.service_name}_{name}")
- Generates the tool's input JSON schema dynamically from the method's type hints, parameters, docstring, and signature. Output is plain text result.tool_definition = Tool( name=tool_name, description=f"{docstring.short_description or "No description available"}", inputSchema={ "type": "object", "properties": properties, "required": required } )
- The MCP server tool handler that resolves the tool by name, calls the bound method from TablesDB (delete_rows), handles Appwrite exceptions, and formats result as text content.@server.call_tool() async def handle_call_tool( name: str, arguments: dict | None ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: try: tool_info = tools_manager.get_tool(name) if not tool_info: raise McpError(f"Tool {name} not found") bound_method = tool_info["function"] result = bound_method(**(arguments or {})) if hasattr(result, 'to_dict'): result_dict = result.to_dict() return [types.TextContent(type="text", text=str(result_dict))] return [types.TextContent(type="text", text=str(result))] except AppwriteException as e: return [types.TextContent(type="text", text=f"Appwrite Error: {str(e)}")] except Exception as e: return [types.TextContent(type="text", text=f"Error: {str(e)}")]
- ToolManager.register_service: Adds service tools (including tables_db_delete_rows) to the central registry used by list_tools and call_tool.def register_service(self, service: Service): """Register a new service and its tools""" self.services.append(service) self.tools_registry.update(service.list_tools())