Skip to main content
Glama
sql-mcp

sql-mcp

by hogiabao2601

execute_query

Read-only

Run a single read-only SQL query and return result columns and rows, with row limits and secret columns masked for safe database inspection.

Instructions

Run ONE read-only statement (SELECT, WITH, SHOW, DESCRIBE, EXPLAIN). No comments, no semicolons. Returns {"columns":[...],"rows":[[...]]}; check the "truncated" field, and add a LIMIT or filters if it is present. Secret-looking columns are returned as "***" (see "masked").

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

Input Schema

NameRequiredDescriptionDefault
queryYes
schemaNo
profileNo
databaseNo
max_rowsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, but the description goes further: it discloses the exact response envelope, the 'truncated' field and the remedial action, and the masking behavior for secret-looking columns via '***'/'masked'. These are non-obvious behaviors an agent could not infer from the 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?

Three short, dense clauses with the hard constraints (single statement, no comments/semicolons) front-loaded, followed by return shape and truncation/masking notes. Nothing is repeated or padded.

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?

The absent output schema is well compensated by the explicit response shape and truncation/masking notes. The remaining gap is coverage of the four optional connection/scope parameters in a tool whose complexity warrants telling the agent how profile, database, and max_rows affect execution.

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

Parameters2/5

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

Schema description coverage is 0%, so the description carries the full burden, yet it never explains the optional schema, profile, database, or max_rows parameters. max_rows in particular is critical given the truncation guidance, but the description only talks about adding a LIMIT/filters rather than referencing the row cap, so an agent cannot map parameters to behavior from this text.

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 ('Run ONE read-only statement') and enumerates the accepted statement types (SELECT, WITH, SHOW, DESCRIBE, EXPLAIN), which sharply bounds what the tool does. It doesn't explicitly differentiate itself from the sibling explain_query, even though EXPLAIN is listed here, so it falls short of full sibling disambiguation.

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

Usage Guidelines3/5

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

Usage constraints are stated clearly (one statement only, no comments, no semicolons, read-only), and it tells the agent what to do when results are truncated. However, it never says when to prefer a sibling such as explain_query, describe_table, or sample_rows instead, leaving the routing decision implicit.

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