Skip to main content
Glama
devopam

MCPg - Production-grade PostgreSQL MCP Server

List locks

list_locks
Read-only

Identify database lock contention by listing held and waiting locks from pg_stat_activity, with waiting locks shown first.

Instructions

List currently-held and waiting locks, joined with backend state from pg_stat_activity. Ordered by (granted ASC, pid) so waiting locks float to the top. Returns lock type, mode, qualified relation name when applicable, transaction / virtualxid, the application_name + state + wait event of the owning backend, and the first 200 chars of its query. Read-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
databaseNoOptional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

Annotations already indicate read-only behavior. The description adds details about the join with backend state, ordering, and returned columns, which provides moderate behavioral context beyond annotations. No information about permissions, side effects, or potential impact is disclosed, but the read-only annotation covers safety.

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, well-structured, and front-loaded with the core purpose. Each sentence adds value: listing, ordering, returned columns, and read-only nature. No unnecessary details.

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?

Given that an output schema exists (not shown but indicated), the description adequately covers input parameters, behavior, and return composition. It mentions optional database filtering and limit. No critical gaps, though it could mention that it reads system views (implied by pg_stat_activity).

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

Parameters2/5

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

Schema coverage is 50%—only the database parameter has a description. The description does not explain the limit parameter or its default behavior, nor does it clarify the effect of the database parameter beyond a terse schema note. The description could have compensated for the low schema coverage but did not, leaving parameter semantics unclear.

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?

The description clearly states the tool lists currently-held and waiting locks joined with backend state. It specifies ordering and return fields, making the purpose unambiguous. However, it does not explicitly differentiate from sibling tools like read_pg_stat_lock or list_active_queries, which may also provide lock information.

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?

The description mentions the output ordering (waiting locks on top) which implies usage for monitoring blocking, and declares read-only. However, it lacks explicit guidance on when to use this tool versus alternatives (e.g., analyze_lock_hotspots for analysis, read_pg_stat_lock for raw stats). No when-not-to-use or prerequisites are stated.

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/devopam/MCPg'

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