Skip to main content
Glama

list_activity

Read-only

Inspect current PostgreSQL sessions with per-state counts and flag idle-in-transaction backends that are holding resources.

Instructions

[READ] Current sessions (pg_stat_activity) with per-state counts.

Flags idle-in-transaction backends (open transactions holding resources).

Args:
    state: Optional exact state filter (active, idle, 'idle in transaction').
    include_idle: Include plain idle backends (default True).
    target: Target name from config; omit for the default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateNo
targetNo
include_idleNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

readOnlyHint=true already covers the safety profile, and the '[READ]' tag plus the description's note about idle-in-transaction backends holding resources adds genuine context about what gets surfaced. It does not disclose result ordering, row volume, or whether it touches the target server in a costly way.

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?

Front-loads the [READ] marker and a one-line summary, then adds a single relevant caution before the arg list. Every line earns its place; only the args block is mildly redundant with the schema.

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?

With no output schema, the description adequately signals the return shape ('per-state counts', flagged idle-in-transaction backends) and documents all three parameters. Cross-references to sibling diagnostic tools are the only notable omission.

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 schema alone gives only titles and defaults; the description compensates by enumerating valid state values (active, idle, 'idle in transaction'), restating the include_idle default with intent, and explaining that target comes from config and defaults when omitted.

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+resource ('Current sessions (pg_stat_activity) with per-state counts'), naming the underlying catalog view and the shape of the result. It implicitly separates itself from lock/query siblings but never names or contrasts them, so it stops short of full sibling differentiation.

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

Usage Guidelines3/5

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

Usage is implied by the 'flags idle-in-transaction backends (open transactions holding resources)' note and the state/include_idle knobs, which tell the agent this is a session-inspection tool. There is no explicit when-to-use versus list_locks or long_running_queries, and no stated prerequisite or exclusion.

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