Skip to main content
Glama
timsuv

sql-explorer-mcp

by timsuv

Run raw SQL query (read-only)

run_query

Run read-only SQL queries on SQL Server with full SELECT support—CTEs, subqueries, aggregates, window functions. Ensures safety by automatically rolling back and limiting results to 500 rows.

Instructions

Run an arbitrary read-only query — CTEs (WITH ...), subqueries, GROUP BY/aggregates, window functions, UNION, ORDER BY, anything a single SELECT statement can express. Only one SELECT (optionally led by a WITH clause) statement is allowed: the query is rejected before it reaches the database if it contains a second statement or any write/DDL/EXEC keyword, and it additionally always runs inside a transaction that gets rolled back afterwards regardless of outcome, as a second line of defense. Results are capped at 500 rows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesA single SELECT statement, optionally starting with a WITH ... CTE
Behavior5/5

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

With no annotations, the description carries full burden and does so admirably: it discloses read-only enforcement, rejection of multi-statement/write/DDL/EXEC queries before the database, transaction rollback as a second defense, and a 500-row cap. This gives agents precise expectations of safety and limitations.

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 sentences, front-loaded with purpose, then safeguards and limits. No filler; every clause adds operational value.

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?

The description covers purpose, allowed syntax, safety mechanics, and result cap, which is substantial for a read-only query tool. It doesn't describe output structure (e.g., row format), but given no output schema is present, a mention of column/row return format would round it out; still, this is a minor gap versus the otherwise thorough disclosure.

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 has 100% coverage for the single 'query' parameter, but the tool description enriches semantics by elaborating what 'single SELECT' entails (CTE-led, rejection conditions, rollback, row cap). This adds meaning beyond the schema's terse description, though the core parameter semantics are schema-provided.

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?

Description clearly states it runs arbitrary read-only SQL with a specific verb ('Run') and resource ('raw SQL query'), enumerating supported constructs (CTEs, subqueries, aggregates, window functions, UNION, ORDER BY). It distinguishes from sibling tools by emphasizing arbitrary single-SELECT capability versus specialized table/join tools.

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 establishes when to use it: for any read-only query expressible as a single SELECT, including advanced SQL. It doesn't explicitly name alternative tools like query_table or join_tables, but the scope implicitly frames it as the general-purpose SQL tool. Lacks explicit exclusions or alternative references, so not a 5.

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/timsuv/sql-explorer-mcp'

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