Skip to main content
Glama
DataPilot MCP

DataPilot MCP

Execute read-only SQL query

execute_readonly_query
Read-only

Run one validated read-only SQL query with bound parameters to retrieve columns, rows, counts, and truncation details; use joins or aggregations when no generated table tool fits.

Instructions

Run one validated read-only SQL statement in the connected database's dialect. Use this for joins, aggregations, or queries without a generated tool. Bind values through parameters with :name placeholders. Returns columns, rows, returned row count and truncation; narrow or aggregate a truncated result. Policy refusals return an error and reason. Call explain_sql_policy for the rules.

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

Input Schema

NameRequiredDescriptionDefault
sqlYesOne read query, e.g. SELECT or WITH ... SELECT.
aliasNoAlias from list_connections. Omit only when exactly one database is open.
max_rowsNoRequested rows, subject to the server cap.
parametersNoBind values by placeholder name without the colon, e.g. {'id': 7}.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.2.0
    • addedInput schema / properties / alias / description
      Added value: +"Alias from list_connections. Omit only when exactly one database is open."
    • changedInput schema / properties / max_rows / description
      Previous value: -"Most rows to return"New value: +"Requested rows, subject to the server cap."
    • changedInput schema / properties / parameters / description
      Previous value: -"Values for :name placeholders"New value: +"Bind values by placeholder name without the colon, e.g. {'id': 7}."
    • changedInput schema / properties / sql / description
      Previous value: -"A single read-only SQL statement"New value: +"One read query, e.g. SELECT or WITH ... SELECT."
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations cover safety (readOnly, non-destructive, not open-world), and the description adds real behavioral context beyond them: single-statement validation, server-side row caps, truncation semantics with a recommended remedy, and that policy refusals surface as an error with a reason. That is materially more than the annotations convey.

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?

Six short sentences, front-loaded with the action, then usage, then results, then failure mode, then the pointer to the policy tool. No filler and nothing 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 description needn't detail return fields, and it covers everything else an agent needs: dialect scope, parameter binding form, row-cap/truncation behavior, and the refusal path. Complete for a 4-parameter query 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 sql, alias, max_rows and parameters are already documented. The description's mention of ':name placeholders' and 'bind values through parameters' largely restates what the schema fields say, so it adds little beyond the baseline.

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 ('Run one validated read-only SQL statement') plus the dialect constraint, and distinguishes itself from generated query tools by naming the cases it uniquely serves (joins, aggregations, ad-hoc queries). An agent can identify the tool's role without opening the 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?

Gives explicit positive guidance (joins, aggregations, queries without a generated tool) and a clear fallback ('Call explain_sql_policy for the rules'). It even prescribes the follow-up action for a truncated result, which is exactly the when-to-do-what routing an agent needs.

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