Skip to main content
Glama

analyze-query-performance

analyze-query-performance
Destructive

Measures SQL query execution time by running it multiple times, helping identify performance bottlenecks in Firebird databases.

Instructions

Analyzes the performance of a SQL query by executing it multiple times and measuring execution time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL query to analyze
paramsNoParameters for parameterized queries
iterationsNoNumber of times to run the query for averaging performance

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoFailure information; present when success is false
resultNoThe legacy JSON payload; present for completed operations and partial batches
successYesFalse for tool failures, including partially failed batches

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv2.12.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / iterations / maximum
      Added value: +9007199254740991
    • removedInput schema / properties / params / items / anyOf
      Removed value: -[
      -  {
      -    "anyOf": [
      -      {
      -        "type": [
      -          "string",
      -          "number"
      -        ]
      -      },
      -      {
      -        "type": "boolean"
      -      }
      -    ]
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / params / items / type
      Added value: +[
      +  "string",
      +  "number",
      +  "boolean",
      +  "null"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$defs": {
      +    "__schema0": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "boolean"
      +        },
      +        {
      +          "type": "null"
      +        },
      +        {
      +          "items": {
      +            "$ref": "#/$defs/__schema0"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "additionalProperties": {
      +            "$ref": "#/$defs/__schema0"
      +          },
      +          "propertyNames": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        }
      +      ]
      +    }
      +  },
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "error": {
      +      "additionalProperties": false,
      +      "description": "Failure information; present when success is false",
      +      "properties": {
      +        "details": {
      +          "additionalProperties": {
      +            "$ref": "#/$defs/__schema0"
      +          },
      +          "propertyNames": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        },
      +        "message": {
      +          "type": "string"
      +        },
      +        "type": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "message",
      +        "type"
      +      ],
      +      "type": "object"
      +    },
      +    "result": {
      +      "additionalProperties": false,
      +      "description": "The legacy JSON payload; present for completed operations and partial batches",
      +      "properties": {
      +        "analysis": {
      +          "type": "string"
      +        },
      +        "averageTime": {
      +          "type": "number"
      +        },
      +        "error": {
      +          "type": "string"
      +        },
      +        "executionTimes": {
      +          "items": {
      +            "type": "number"
      +          },
      +          "type": "array"
      +        },
      +        "maxTime": {
      +          "type": "number"
      +        },
      +        "minTime": {
      +          "type": "number"
      +        },
      +        "query": {
      +          "type": "string"
      +        },
      +        "rowCount": {
      +          "type": "number"
      +        },
      +        "success": {
      +          "type": "boolean"
      +        }
      +      },
      +      "required": [
      +        "query",
      +        "executionTimes",
      +        "averageTime",
      +        "minTime",
      +        "maxTime",
      +        "rowCount",
      +        "success",
      +        "analysis"
      +      ],
      +      "type": "object"
      +    },
      +    "success": {
      +      "description": "False for tool failures, including partially failed batches",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "success"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, and openWorldHint=true. The description adds the key behavioral detail of repeated execution, which plausibly explains the destructive flag, but it does not warn that executing a mutating SQL statement multiple times can have compounding side effects. Given annotations carry the safety profile, this is adequate but not rich.

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?

A single efficient sentence with the mechanism front-loaded and no filler. It could arguably use one more sentence given the tool's destructive nature, but nothing present is wasted.

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

Completeness3/5

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

An output schema exists, so return values need not be described. However, for a destructive, non-idempotent tool that executes arbitrary SQL repeatedly, the description omits any caution about mutating queries and does not route the agent to cleaner alternatives such as get-execution-plan.

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

Parameters3/5

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

Schema coverage is 100%, so sql, params, and iterations are fully documented in the schema itself. The description's 'executing it multiple times' loosely echoes the iterations parameter but adds no format or syntax detail beyond it. Baseline 3 applies when the schema does the explaining.

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 (analyzes performance) and resource (SQL query), and clarifies the mechanism (repeated execution with timing measurement). It does not, however, distinguish itself from siblings like get-execution-plan or execute-query, which a reader would have to infer.

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

Usage Guidelines2/5

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

No guidance on when to use this versus get-execution-plan (which likely analyzes performance without executing) or execute-query. There is no statement of preconditions or exclusions, leaving the agent to guess based on the name alone.

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