Skip to main content
Glama
MySQL MCP Server

MySQL MCP Server

by berthojoris

run_select_query

Read-onlyIdempotent

Executes read-only SELECT queries with parameterized inputs, optimizer hints, caching, and dry-run plans, supporting JOINs, subqueries, and aggregations for safe data retrieval.

Instructions

⚡ PRIMARY TOOL FOR SELECT QUERIES. Executes read-only SELECT statements with parameterization, optimizer hints, query caching, and dry-run mode. Supports complex queries with JOINs, subqueries, and aggregations. ⚠️ ONLY for SELECT - use execute_write_query for INSERT/UPDATE, use execute_ddl for CREATE/ALTER/DROP.

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": {
      "query": "<query>"
    },
    "name": "run_select_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
hintsNoOptional MySQL optimizer hints to apply to the query
queryYesSQL SELECT query to execute
paramsNoOptional array of parameters for parameterized queries
dry_runNoIf true, returns query plan and estimated cost without executing (Safe Mode)
useCacheNoWhether to use query result caching when the cache is enabled with CACHE_ENABLED=true (default: true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.46.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety bar is lower; the description still adds that execution is read-only-enforced, supports parameterization for injection safety, applies optimizer hints, and can run in dry-run mode. It does not say what happens if a non-SELECT statement is submitted (rejection message vs. silent failure) or how cache staleness is handled, which keeps it out of the top score.

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?

Three sentences, front-loaded with the core action and followed by an explicit exclusion warning, so the highest-value information lands first. There is mild redundancy between "Executes read-only SELECT statements" and "ONLY for SELECT," and the emoji/alert styling is decorative rather than informative.

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 five-parameter read-only query tool with full schema coverage and strong annotations, the description covers scope, safety posture, and alternative routing adequately. The one material gap is the absence of an output schema combined with no description of what dry_run returns (plan and estimated cost are hinted at only in the schema, not the description), but everything needed to select and invoke the tool is present.

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 description coverage is 100% and every parameter (query, params, hints with all seven sub-properties, dry_run, useCache) is already documented inline. The description lists the same capability areas (parameterization, hints, caching, dry-run) but adds no format details, syntax, or precedence rules beyond the schema, so baseline 3 applies.

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?

States a specific verb and resource ("Executes read-only SELECT statements") and enumerates distinguishing capabilities: parameterization, optimizer hints, query caching, and dry-run mode. It also declares itself the primary entry point for SELECT work, which lets an agent differentiate it from write/DDL siblings named in the same sentence.

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?

Explicit when-to-use and when-NOT-to-use routing: "ONLY for SELECT - use execute_write_query for INSERT/UPDATE, use execute_ddl for CREATE/ALTER/DROP." The alternative tool names and the condition selecting each are given outright, leaving nothing to inference.

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