Skip to main content
Glama

terminate_backend

Destructive

Terminate a PostgreSQL backend by PID to stop a runaway, blocking, or unwanted session; preview with dry_run before making an irreversible change.

Instructions

[WRITE][risk=high] Terminate a backend (pg_terminate_backend). No safe inverse.

Captures the backend's pid + query for the audit trail; a terminate cannot be
undone, so no undo is offered. Pass dry_run=True to preview.

Refuses this tool's own backend pid — including under dry_run, which must
report a refusal rather than preview a call that will be refused.

Args:
    pid: Backend process id (from list_activity).
    dry_run: If True, preview without terminating.
    target: Target name from config; omit for the default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYes
targetNo
dry_runNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already declare destructive/not-idempotent/not-readonly, yet the description adds substantial context beyond them: no safe inverse, an audit trail capturing pid+query, a live dry-run preview mode, and the self-pid refusal that applies even during dry_run. This is exactly the behavioral depth annotations cannot express.

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

Conciseness4/5

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

Risk tag is front-loaded, followed by impact, preview, and refusal behavior, then an Args block. Every sentence adds information and the param list is warranted given 0% schema coverage. Slightly dense but no filler.

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 high-risk mutation with no output schema, the description covers everything an agent needs: irreversibility, audit trail, preview path, refusal constraint, and per-parameter sourcing/defaults. Nothing essential to correct invocation is missing.

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

Parameters4/5

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

Schema description coverage is 0%, so the description carries the full burden, and it documents all three params: pid (sourced from list_activity), dry_run (preview behavior), and target (from config, omit for default). This compensates well, though pid's expected value range/format is not elaborated.

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

Purpose4/5

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

States a specific verb and resource ("Terminate a backend") and maps it to the underlying pg_terminate_backend call, so the effect is unambiguous. The [WRITE][risk=high] tag reinforces the operation class. It does not explicitly differentiate itself from the softer sibling cancel_query, which would have earned a 5.

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

Usage Guidelines4/5

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

Gives concrete operational guidance: use dry_run=True to preview, and pid comes from list_activity. The refusal condition (own backend pid, even under dry_run) is spelled out. No explicit when-not/alternative guidance relative to cancel_query, so it stops short of a 5.

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