Skip to main content
Glama
Teja-sudo

postgres-mcp-server

by Teja-sudo

find_blocking_queries

Identify blocking database sessions in a hierarchical tree to diagnose performance issues and select queries to kill.

Instructions

Show currently-blocking sessions in a friendly tree (blocker → blocked) using pg_stat_activity ⨝ pg_blocking_pids(). Replaces the gnarly join an AI agent struggles to write. Returns each session's pid, user, database, application name, state, current query, time in state, and wait_event. Use to diagnose slowdowns and pick a candidate for kill_query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_idleNo
limitNo
serverNo
databaseNo
schemaNo
Behavior3/5

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

Describes the output fields (pid, user, database, etc.) and the join operation, but does not explicitly state that the tool is read-only or non-destructive. With no annotations, more explicit behavioral disclosure would be beneficial.

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?

The description is concise (2-3 sentences), front-loaded with the main purpose, and avoids redundancy. Minor improvement could be adding structure for parameter explanations.

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

Completeness2/5

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

Despite no output schema and 0% parameter coverage, the description explains outputs well but completely ignores input parameters. This leaves significant gaps for the agent to use the tool correctly.

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

Parameters1/5

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

Schema description coverage is 0%, and the description provides no explanation of the 5 parameters (include_idle, limit, server, database, schema). The agent receives no guidance on how to use these inputs.

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?

The description clearly states it shows blocking sessions in a tree format using pg_stat_activity and pg_blocking_pids, with a specific purpose of diagnosing slowdowns. It distinguishes itself from siblings like kill_query and lock_check.

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?

Explicitly says 'Use to diagnose slowdowns and pick a candidate for kill_query,' providing clear context and a downstream action. However, it does not specify when not to use or compare to alternatives like lock_check.

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/Teja-sudo/postgres-mcp-server'

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