Skip to main content
Glama

run_query

Read-only

Execute one read-only SQL statement against a MySQL database and return columns and rows, with parameter binding and a 200-row cap that flags truncated results.

Instructions

Runs one read-only statement (SELECT, WITH, TABLE, VALUES, SHOW, DESCRIBE or EXPLAIN) and returns columns and rows, at most 200 rows with truncated=true if there were more. Use ? placeholders with params for values. Refused statements return refused=true with a reason and a suggestion.

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": "run_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne SQL statement.
paramsNoValues for ? placeholders, in order. Bound by the server, never spliced into the SQL. SELECT, TABLE and VALUES only.
databaseNoDefault database for unqualified table names. Omit if every name is qualified as db.table.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=false, yet the description adds genuinely new behavior: a 200-row cap signaled via truncated=true, and refused statements returning refused=true with a reason and suggestion. It omits timeout or transaction semantics, but the extra disclosure is well above the annotation baseline.

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 dense sentences with the core action first, then output limits, then parameter mechanics, then failure semantics. No wasted wording and nothing important is buried.

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?

With an output schema present, the definition needn't restate return columns; it still explains both truncated and refused outcomes, which are the two things an agent must handle. Combined with full parameter coverage, nothing needed for a correct call 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?

Schema coverage is 100%, so all three parameters are already documented in the schema, including the ? placeholder ordering and binding note. The description's 'use ? placeholders with params' sentence largely restates that, adding little new meaning beyond the scheme.

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?

The description uses a specific verb ('Runs') and resource ('one read-only statement') and enumerates the exact permitted statement types (SELECT, WITH, TABLE, VALUES, SHOW, DESCRIBE, EXPLAIN). It does not, however, distinguish itself from siblings such as explain_query or describe_table, which overlap with the EXPLAIN/DESCRIBE it claims to accept.

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?

It gives clear operating context: exactly one statement, read-only only, with the allowed statement keywords spelled out. It stops short of naming alternatives, so an agent must infer from sibling names whether to use explain_query or describe_table instead of running EXPLAIN/DESCRIBE here.

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