Skip to main content
Glama

handle_diagnose_query_performance

Analyzes Redshift query performance by fetching execution plan, metrics, and alerts, generating structured reports with identified issues and optimization recommendations.

Instructions

Analyzes a specific query's execution performance.

Fetches query text, execution plan, metrics, alerts, compilation info,
skew details, and optionally historical run data. Uses a formatting
utility to synthesize this into a structured report with potential issues
and recommendations.

Args:
    ctx: The MCP context object.
    query_id: The numeric ID of the Redshift query to analyze.
    compare_historical: Fetch performance data for previous runs of the
                       same query text. Defaults to True.

Returns:
    A dictionary conforming to DiagnoseQueryPerformanceResult structure:
    - On success: Contains detailed performance breakdown, issues, recommendations.
    - On query not found: Raises QueryNotFound exception.
    - On other errors: Raises DataApiError or similar for FastMCP to handle.

Raises:
    DataApiError: If a critical error occurs during script execution or parsing.
    QueryNotFound: If the specified query_id cannot be found in key tables.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compare_historicalNo
query_idYes
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 and does so well. It describes what data gets fetched, how it's synthesized into a structured report, and documents specific error conditions (QueryNotFound, DataApiError). It also mentions the formatting utility and the tool's ability to optionally fetch historical data. While it doesn't mention rate limits or authentication needs, it provides substantial behavioral context for a diagnostic tool.

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 appropriately sized and well-structured with clear sections: purpose statement, what it fetches, how it processes data, args documentation, returns documentation, and raises documentation. Every sentence earns its place, though the returns section could be slightly more concise. The information is front-loaded with the core purpose stated first.

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?

For a diagnostic tool with 2 parameters, no annotations, and no output schema, the description provides substantial context. It explains what data gets collected, how it's processed, parameter meanings, and error conditions. The main gap is the lack of detail about the exact structure of the returned dictionary or what specific metrics/alerts are examined, but given the tool's complexity, this is reasonably complete.

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 description coverage, the description fully compensates by providing detailed parameter semantics. It explains that query_id is 'the numeric ID of the Redshift query to analyze' and that compare_historical controls whether to 'fetch performance data for previous runs of the same query text' with its default value. This adds crucial meaning beyond the bare schema types (integer, boolean).

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 the tool's purpose with specific verbs ('analyzes', 'fetches', 'synthesizes') and resources ('query's execution performance', 'query text, execution plan, metrics, alerts, compilation info, skew details, historical run data'). It distinguishes from sibling tools like handle_check_cluster_health or handle_diagnose_locks by focusing specifically on query performance analysis rather than cluster health or lock diagnosis.

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?

The description provides clear context for when to use this tool: when you need to analyze a specific query's performance with detailed metrics and recommendations. It doesn't explicitly state when NOT to use it or name specific alternatives among siblings, but the context is sufficiently clear for an agent to understand this is for query performance diagnosis rather than general cluster monitoring or table inspection.

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

Related 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/vinodismyname/redshift-utils-mcp'

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