Command Tool

A tool that performs actions with side effects.

category: Tool
arcade.dev/patterns

Context

Building tools that modify state or trigger actions.

Problem

Agents need to understand which tools have consequences and require careful invocation.

Solution

A Command Tool:
- Modifies state: Creates, updates, or deletes
- Has side effects: Triggers external actions
- May not be idempotent: Repeat calls may produce different results (e.g. creating a database entry twice)
- Requires confirmation: For destructive operations

Examples

Python
@tool(destructive=True)
def delete_user(user_id: str) -> DeleteResult:
    """Permanently delete a user. Irreversible."""
    return db.users.delete(user_id)
TypeScript
const deleteUser = tool({
  name: "delete_user",
  destructive: true,  // Hint: has consequences
  execute: async ({ userId }) => db.users.delete(userId)
});

Considerations

  • Document irreversible operations clearly
  • Consider requiring confirmation for destructive actions
  • Make commands idempotent where possible

Related Patterns

More in Tool