delete_command_tool
Remove a command-usage record from the MCP server's history by specifying its unique identifier.
Instructions
Delete a command-usage record by its id.
Args:
row_id: The id field from history recordsInput Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| row_id | Yes |
Implementation Reference
- src/mcp_commands/server.py:120-131 (handler)Main MCP tool handler for delete_command_tool. Decorated with @mcp.tool() and calls delete_command() to perform the actual deletion, returning appropriate success/warning messages.
@mcp.tool() def delete_command_tool(row_id: int) -> str: """ Delete a command-usage record by its id. Args: row_id: The id field from history records """ deleted = delete_command(row_id=row_id) if deleted: return f"🗑️ Deleted record id={row_id}" return f"⚠️ No record found with id={row_id}" - src/mcp_commands/server.py:120-120 (registration)Tool registration point - the @mcp.tool() decorator registers delete_command_tool with the MCP server, exposing it as an available tool.
@mcp.tool() - src/mcp_commands/storage.py:195-203 (helper)Database helper function that executes the actual DELETE SQL query against PostgreSQL, returning True if a row was deleted or False if not found.
def delete_command(row_id: int) -> bool: """Delete a single record by id. Returns True if a row was deleted.""" conn = get_connection() with conn.cursor() as cur: cur.execute("DELETE FROM command_log WHERE id = %s", (row_id,)) deleted = cur.rowcount > 0 conn.commit() conn.close() return deleted