Skip to main content
Glama

terminate_backend

Terminate a PostgreSQL backend by PID to stop blocking or stuck queries. Includes dry-run preview and audit logging to prevent accidental termination.

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
Behavior5/5

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

In absence of annotations, description fully discloses write operation, high risk, no undo, audit trail capture, refusal of own PID, and dry_run behavior. No contradiction with annotations (none provided).

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?

Well-structured with tags [WRITE][risk=high], clear summary, then args. Slightly verbose but efficient for the complexity. Every sentence adds value.

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

Completeness4/5

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

Covers input semantics and constraints well, but does not describe return value/output. Given no output schema and moderate complexity, this is a minor gap.

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

Parameters5/5

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

With 0% schema coverage, description adds valuable meaning for all three parameters: pid (source from list_activity), dry_run (preview vs. execute), and target (config-driven, optional).

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?

Description explicitly states 'Terminate a backend (pg_terminate_backend)' and distinguishes from sibling tools like cancel_query by noting high risk, no inverse, and audit trail capture.

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?

Provides clear when-to-use (dry_run for preview) and behavior under refusal, but does not explicitly compare to alternative tool cancel_query or state when not to use terminate.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AIops-tools/Postgres-AIops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server