Skip to main content
Glama
weijie-tan3

Trino MCP Server

by weijie-tan3

execute_query_read_only

Execute read-only SQL queries on Trino clusters, with optional output to file to prevent AI hallucination.

Instructions

Execute a read-only SQL query and return the results.

This tool is designed for read-only queries (SELECT, SHOW, DESCRIBE, EXPLAIN, etc.). It validates that the query is read-only before execution.

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 (must be read-only) 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 (read-only)
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
Behavior4/5

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

With no annotations provided, the description takes on full responsibility for behavioral disclosure. It reveals key traits: validation of read-only status, optional output_file writes directly to disk, only a confirmation message returned, and format derived from file extension. This goes well beyond a simple 'runs a query' statement, though it stops short of explaining error handling or permissions.

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 front-loaded with a clear purpose statement, followed by concise usage notes and parameter details. Each paragraph serves a distinct role—overview, file behavior, args—and the wording is efficient. The only slight redundancy is the repeated 'not returned to the AI,' but it appears in different contexts and reinforces a critical caveat.

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 presence of an output schema, return values are covered. The description fully equips an agent to select and invoke the tool: it defines read-only scope, explains the output_file option and its format, and clarifies when results are returned vs. written to disk. No critical information is missing for safe and correct usage.

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 for output_file—that results are written to disk and NOT returned to the AI, preventing hallucination, and explains the format derivation (.csv vs .json). This supplements the schema's own description with rationale and practical guidance, earning above 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?

The description opens with 'Execute a read-only SQL query and return the results'—a specific verb and resource that clearly identifies the tool's function. It further distinguishes itself from the sibling execute_query by explicitly focusing on read-only queries and validation.

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 states this is 'designed for read-only queries (SELECT, SHOW, DESCRIBE, EXPLAIN, etc.)' and that it 'validates that the query is read-only before execution,' giving clear context on when to use it. It does not explicitly mention alternatives or exclusions, but the read-only scoping is evident and the sibling naming supports differentiation.

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