Skip to main content
Glama
call518

MCP PostgreSQL Operations

get_pg_stat_monitor_recent_queries

Retrieve detailed performance data for recently executed PostgreSQL queries using pg_stat_monitor extension. Analyze query execution statistics, client information, and time-based patterns for monitoring and troubleshooting.

Instructions

[Tool Purpose]: Analyze recently executed queries and detailed monitoring information using pg_stat_monitor extension

[Exact Functionality]:

  • Retrieve detailed performance information of recently executed queries

  • Display client IP and time bucket information by execution period

  • Provide more detailed monitoring data than pg_stat_statements

[Required Use Cases]:

  • When user requests "recent queries", "detailed monitoring", "pg_stat_monitor", etc.

  • When real-time query performance monitoring is needed

  • When client-specific or time-based query analysis is required

[Strictly Prohibited Use Cases]:

  • When pg_stat_monitor extension is not installed

  • Requests for query execution or data modification

  • Requests for monitoring configuration changes or data reset

Args: limit: Number of recent queries to retrieve (default: 20, max: 100) database_name: Database name to analyze (uses default database if omitted)

Returns: Detailed monitoring information including query text, execution statistics, client info, and bucket time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
database_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: it's a read-only monitoring tool (implied by 'retrieve' and 'display'), requires the pg_stat_monitor extension to be installed (a prerequisite), and provides detailed performance information. However, it doesn't mention potential limitations like rate limits, authentication needs, or error conditions, leaving some behavioral aspects uncovered.

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 well-structured with labeled sections ([Tool Purpose], [Exact Functionality], etc.) and front-loaded key information. Each sentence adds value, such as differentiating from pg_stat_statements and specifying use cases. However, it could be slightly more concise by integrating the 'Args' and 'Returns' details more seamlessly into the main text.

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?

Given the tool's complexity (monitoring queries with 2 parameters), no annotations, and an output schema present, the description is complete. It covers purpose, functionality, use cases, prohibitions, parameter semantics, and return information. The output schema handles return values, so the description doesn't need to detail them further, making it adequately comprehensive for the context.

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?

The schema description coverage is 0%, so the description must compensate. It adds meaningful semantics for both parameters: 'limit' is described as 'Number of recent queries to retrieve (default: 20, max: 100)' and 'database_name' as 'Database name to analyze (uses default database if omitted)'. This provides clear context beyond the schema's basic titles, though it doesn't elaborate on format constraints or edge cases.

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 explicitly states the tool's purpose as 'Analyze recently executed queries and detailed monitoring information using pg_stat_monitor extension' with specific verbs ('analyze', 'retrieve', 'display', 'provide') and resources ('queries', 'monitoring information', 'client IP', 'time bucket information'). It clearly distinguishes from sibling tools like 'get_pg_stat_statements_top_queries' by noting it provides 'more detailed monitoring data than pg_stat_statements'.

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

Usage Guidelines5/5

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

The description includes explicit 'Required Use Cases' (e.g., when user requests 'recent queries', 'detailed monitoring', 'pg_stat_monitor', etc.) and 'Strictly Prohibited Use Cases' (e.g., when pg_stat_monitor extension is not installed, requests for query execution or data modification). It provides clear when-to-use and when-not-to-use guidance with specific alternatives implied (e.g., avoiding data modification tools).

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/call518/MCP-PostgreSQL-Ops'

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