Skip to main content
Glama
weijie-tan3

Trino MCP Server

by weijie-tan3

execute_query

Execute SQL queries on Trino clusters. Optionally write results to a JSON or CSV file to prevent AI hallucination and enable downstream processing.

Instructions

Execute a SQL query and return the results.

This tool can execute any SQL query including write operations (INSERT, UPDATE, DELETE, etc.). By default, write operations are disabled for security. Set ALLOW_WRITE_QUERIES=true to enable.

When output_file is provided, results are written directly to disk and only a confirmation message is returned. This prevents raw data from passing through the AI, avoiding hallucination when processing large result sets. The output format (JSON or CSV) is derived from the file extension.

Args: query: The SQL query to execute output_file: File path to write results to. Extension determines format (.csv → CSV, .json or others → JSON). Results are NOT returned to the AI, enabling reliable downstream processing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe SQL query to execute
output_fileNoFile path to write results to. Format is derived from the file extension: '.csv' for CSV, '.json' (or others) for JSON. When set, results are written directly to disk and are NOT returned to the AI, preventing hallucinated values and enabling subsequent processing by other tools.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations, the description carries the full burden. It discloses that write operations are disabled by default and require ALLOW_WRITE_QUERIES=true, and explains the output_file behavior (results go to disk, only confirmation returned, prevents hallucination). These are substantive behavioral details beyond the schema.

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 well-structured with a clear opening sentence, paragraphs on key behaviors, and a bulleted args list. Every sentence provides useful information with no fluff, and the most important details are front-loaded.

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?

Given the tool's moderate complexity (write support, output_file, security flag), the description covers all major aspects: the query execution capability, the write enable flag, the output_file behavior and format, and the rationale for disk writing. With an output schema present, return values need not be explained. It is complete for successful invocation.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds meaningful context beyond the schema: for output_file, it explains the rationale (prevents hallucination, enables downstream processing) and the format derivation. The query param is minimally restated, but the added value for output_file justifies a 4.

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 starts with 'Execute a SQL query and return the results' – a specific verb and resource. It clearly distinguishes itself from siblings, especially execute_query_read_only, by stating it can execute write operations (INSERT, UPDATE, DELETE) and by describing the output_file behavior for disk writes.

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 clear context for when to use this tool: for any SQL query, including write operations, and for scenarios where results should be written to disk to avoid hallucination. It does not explicitly name alternatives like execute_query_read_only or state when NOT to use this tool, so it lacks explicit when-not guidance.

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/weijie-tan3/trino-mcp'

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