Skip to main content
Glama
tokenlite-mysql-mcp

tokenlite-mysql-mcp

by andezdev

mydatabase_explain_query

Read-onlyIdempotent

Analyze a validated SELECT query with MySQL EXPLAIN to verify index usage and diagnose why a query was blocked. Returns CSV output and blocks ANALYZE and non-SELECT statements.

Instructions

Returns MySQL EXPLAIN output as CSV for a validated SELECT query. SQL is AST-validated and timeout-protected; ANALYZE and non-SELECT statements are blocked. Unlike execute_safe_query, this does NOT block full table scans — use it to diagnose why a query was blocked or to verify index usage before executing.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "<sql>"
    },
    "name": "mydatabase_explain_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesThe SELECT query to analyze.

Output Schema

NameRequiredDescriptionDefault
rowsYesEXPLAIN output rows

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed23 schema fields changedv3.1.3
    • changedOutput schema / properties / rows / items / additionalProperties
      Previous value: -falseNew value: +{}
    • removedOutput schema / properties / rows / items / properties / Extra / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / Extra / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • addedOutput schema / properties / rows / items / properties / filtered
      Added value: +{
      +  "description": "Estimated filtered percentage (MySQL 8+)",
      +  "type": [
      +    "number",
      +    "null"
      +  ]
      +}
    • removedOutput schema / properties / rows / items / properties / id / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / id / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / rows / items / properties / key / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / key / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / rows / items / properties / key_len / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / key_len / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • addedOutput schema / properties / rows / items / properties / partitions
      Added value: +{
      +  "description": "Partition pruning info (MySQL 8+)",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • removedOutput schema / properties / rows / items / properties / possible_keys / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / possible_keys / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / rows / items / properties / ref / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / ref / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / rows / items / properties / rows / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / rows / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / rows / items / properties / select_type / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / select_type / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / rows / items / properties / table / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / table / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / rows / items / properties / type / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / rows / items / properties / type / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  2. Addedv3.1.2

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and idempotentHint, but the description goes well beyond them: AST validation, timeout protection, blocking of ANALYZE and non-SELECT statements, CSV output format, and the notable non-restriction on full table scans. These are exactly the behavioral facts an agent needs before invoking it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences: output/scope first, safety constraints second, sibling contrast and use case last. Every clause carries distinct information with no filler.

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?

For a single-parameter read-only tool that already has annotations and an output schema, the description covers output format, validation behavior, blocked inputs, and selection guidance. Nothing needed to call it correctly is missing.

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?

There is only one parameter and schema coverage is 100%, with the schema already saying 'The SELECT query to analyze.' The description reinforces the SELECT-only constraint but adds no syntax, formatting, or example information beyond what the schema provides, so the baseline of 3 holds.

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 first sentence names a specific verb and resource — returning MySQL EXPLAIN output as CSV for a validated SELECT query — and the description explicitly names the sibling `execute_safe_query` and how this tool differs from it. An agent can select this over the sibling without opening either schema.

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?

It gives explicit use cases ('diagnose why a query was blocked' or 'verify index usage before executing') and a clear contrast condition against the alternative tool. When-to-use and how-it-differs are both stated rather than inferred.

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