Skip to main content
Glama

Run SQL

query_run_sql
Read-onlyIdempotent

Runs a read-only SQL SELECT against one uploaded spreadsheet and returns the result rows. Table names come from query_describe — call that first. Use this instead of reading the file when the caller wants an aggregate, a filter, or a computed answer rather than the raw rows. Only SELECT is allowed, and only tables from the named file are in scope.

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>",
      "path": "<path>",
      "context": "<context>"
    },
    "name": "query_run_sql"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesA single read-only SQL SELECT statement. Table names must come from query_describe.
pathYesVFS path of the spreadsheet to query, e.g. '/finance/sales.xlsx'.
contextYesExplain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): "Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization."
workspace_idNoWhich workspace to act in - a workspace id (whoami returns the id of your default workspace). Omit to use your default workspace.
output_formatNoUse 'table' if the user asked to see a visual report. Use 'csv' for large data transfers. Use 'json' if you need to process the data internally.json

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and openWorldHint=false, so safety is covered; the description adds the enforcement rule 'Only SELECT is allowed' and the data-scope rule 'only tables from the named file are in scope', which an agent could not infer from annotations alone. It omits practical behavior such as row limits, timeouts, or pagination on large results, which is the main remaining gap.

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?

Four short sentences, front-loaded with what the tool does and then the prerequisite and routing rule; no filler. Minor redundancy between 'read-only SQL SELECT' and 'Only SELECT is allowed', which repeats the same constraint twice.

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 5-parameter tool with full schema coverage, annotations covering safety, and no output schema, the description covers purpose, prerequisite, scope limits, and return form ('result rows'), which is close to sufficient. It could say more about result size limits and error behavior on invalid SQL.

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 parameters are already documented in structured form and the baseline is 3. The description restates the sql constraint (table names from query_describe) but adds no new semantics for path, output_format, workspace_id, or context beyond what the schema says.

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 ('Runs a read-only SQL SELECT against one uploaded spreadsheet') plus what is returned ('result rows') and the scope limit ('only tables from the named file'). This is far more specific than the title 'Run SQL' and lets an agent distinguish it from query_run_jsonata or read_file.

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?

Explicitly gives a prerequisite ('Table names come from query_describe — call that first') and a routing rule ('Use this instead of reading the file when the caller wants an aggregate, a filter, or a computed answer rather than the raw rows'). The when-not condition is stated in terms of the alternative behavior, so an agent can decide without inspecting siblings.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources