Skip to main content
Glama
db-conn-mcp

db-conn-mcp

cancel_query

DestructiveIdempotent

Stop a stuck or runaway database statement by server backend PID; the session survives and uncommitted work is rolled back.

Instructions

Cancel the statement running in server backend pid (find pids via show_activity).

Use for a stuck or runaway statement. To cap your own query's run time instead, pass timeout_ms to execute_read_query or execute_write_query.

Returns meta, pid and cancelled. Cancels the statement only — the session survives, and the cancelled statement's uncommitted work is rolled back. The request is sent at once; the statement stops at its next interrupt check, usually within moments. cancelled=false means the pid doesn't exist or you lack permission (same database user required).

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": {
      "database": "<database>",
      "pid": "<pid>"
    },
    "name": "cancel_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
pidYesServer backend process id, as show_activity reports it.
databaseYesName of a configured database, exactly as list_databases returns it (case-sensitive). Not a DSN, host or server-side database name. An unknown name is an error that lists the configured names.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.8.1
    • addedInput schema / properties / database / description
      Added value: +"Name of a configured database, exactly as list_databases returns it (case-sensitive). Not a DSN, host or server-side database name. An unknown name is an error that lists the configured names."
    • addedInput schema / properties / pid / description
      Added value: +"Server backend process id, as show_activity reports it."
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations it discloses scope (statement only, session survives), side effects (uncommitted work rolled back), timing (request sent at once, stops at next interrupt check), and the failure meaning of cancelled=false including the same-database-user permission requirement. This is exactly the context the destructiveHint/idempotentHint flags cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the action and its scope, then alternatives, then return values and semantics. Every sentence carries distinct information — no restatement of the name or padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter mutation tool with no output schema, the description covers the return fields (meta, pid, cancelled), the meaning of each outcome, the rollback behavior, and permissions. Nothing an agent needs to call it safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters are already documented, including how to obtain the pid and the case-sensitive database name. The description adds only the show_activity pointer, which the pid schema description already states, so it neither compensates for nor extends the schema meaningfully.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — cancel the statement running in server backend `pid` — and immediately distinguishes it from query-execution siblings by pointing to show_activity for pid discovery. An agent can identify the operation without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit trigger ('use for a stuck or runaway statement') and an explicit alternative with the condition that selects it ('to cap your own query's run time instead, pass timeout_ms to execute_read_query or execute_write_query'). No inference is required.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.