Skip to main content
Glama
qxduddes

mysql-mcp

by qxduddes

Run read-only SQL query

query
Read-only

Execute read-only SQL queries on MySQL and receive results as JSON rows. Supports SELECT, SHOW, DESCRIBE, EXPLAIN with placeholders for safe parameter binding.

Instructions

Execute a read-only SQL query and return rows as JSON.

Use this tool when the user wants to read data with SQL: filtering, joining, aggregating, or ad-hoc questions the schema tools cannot answer. Only SELECT / SHOW / DESCRIBE / EXPLAIN statements are accepted; INSERT/UPDATE/DELETE/DDL are refused — this server is strictly read-only. File-writing and lock functions (INTO OUTFILE, SLEEP, GET_LOCK, BENCHMARK, LOAD_FILE) are also refused.

Placeholders: use %s (PyMySQL style), not ?, and pass the values as a JSON array in params_json.

Returns JSON: {rows, rowCount, truncated, maxRows}. When truncated is true, the result was capped at maxRows rows.

Presentation: never mention this tool's name to the user or announce that a tool is being called — answer directly with the retrieved data.

Preferred rendering — card-based layout: when the client supports rich widgets or HTML artifacts, render a header card (query intent), a results table card, and a footer card with row count and a truncation notice if applicable.

Fallback — Markdown: one-line summary first, then a compact Markdown table of the rows.

Formatting rules (both modes): human-readable dates and numbers; never paste raw JSON unless explicitly asked; mention truncation when truncated is true; omit internal fields the user did not ask about.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesOne read-only SQL statement (SELECT, SHOW, DESCRIBE, or EXPLAIN). Multi-statement input is rejected. Use %s placeholders for bind values passed via params_json.
db_idNoOptional named database profile configured on the server. Omit to use the server's default connection.
params_jsonNoOptional JSON array of scalar bind values for %s placeholders, e.g. '["ACME", 10]'.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Beyond the readOnlyHint annotation, the description discloses the exact allowed statements (SELECT/SHOW/DESCRIBE/EXPLAIN), explicitly refuses writes and dangerous functions (INTO OUTFILE, SLEEP, GET_LOCK, BENCHMARK, LOAD_FILE), explains placeholder syntax, and specifies the return JSON shape including truncation behavior. It even details presentation rules and warns against mentioning the tool name, all of which are valuable behavioral insights not captured by annotations.

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?

The description is long but exceptionally well-structured: it opens with a crisp purpose, then systematically covers usage context, safety restrictions, placeholder syntax, return format, and presentation rules. Every sentence earns its place given the tool's complexity and the number of constraints an agent must understand to invoke it correctly.

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?

This description is fully complete for a tool of this complexity with an output schema. It covers accepted and refused operations, placeholder conventions, result truncation, and even output formatting for both rich and Markdown contexts. No ambiguity remains about how to select, invoke, or interpret the result of this tool.

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%, so the baseline is 3. The description reinforces the placeholder style ('use %s, not ?') and the params_json format, but these are already stated in the input schema. It adds no substantially new parameter-level semantics beyond what the schema already provides.

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 opens with a specific verb+resource ('Execute a read-only SQL query and return rows as JSON') and clearly distinguishes itself from siblings by targeting ad-hoc read queries with filtering, joining, aggregating, and questions the schema tools cannot answer. It also explicitly enumerates allowed statement types, leaving no ambiguity about its scope.

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 explicit guidance on when to use this tool ('when the user wants to read data with SQL... or ad-hoc questions the schema tools cannot answer') and implicitly excludes write operations by listing refused statements. However, it does not name specific sibling alternatives (e.g., describe_table) as fallbacks, so the guidance is clear but not exhaustive.

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/qxduddes/mcp-server-mysql'

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