cancel_query
Stop a running PostgreSQL query by backend PID to end long-running or blocking statements. Preview with dry-run; pid and query are logged for audit.
Instructions
[WRITE][risk=high] Cancel a backend's running query (pg_cancel_backend). No inverse.
Captures the backend's pid + query for audit; a cancel has no undo. Pass
dry_run=True to preview.
Refuses this tool's own backend pid — the query it would cancel is this very
call. Enforced under dry_run too.
Args:
pid: Backend process id (from list_activity).
dry_run: If True, preview without cancelling.
target: Target name from config; omit for the default.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pid": "<pid>"
},
"name": "cancel_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pid | Yes | ||
| target | No | ||
| dry_run | No |