Skip to main content
Glama

Query SQLite database

sqlite_query
Read-onlyIdempotent

Run one read-only SQL statement against a SQLite file to inspect data safely, returning JSON rows with row limits and blocking writes or ATTACH.

Instructions

Run one read-only SQL statement on a SQLite file (sqlite3 -readonly -safe -json; ATTACH and other escapes are disabled). Must start with SELECT, WITH, VALUES, or EXPLAIN [QUERY PLAN] followed by one of those. Runs wrapped as SELECT * FROM () LIMIT <limit+1>; truncated=true means more rows exist. ";" is allowed only inside string literals, quoted identifiers and comments, plus one trailing. Bind parameters (?, :x, @x, $x, #x) are rejected — write values as literals. EXPLAIN describes the wrapped statement. BLOBs are not converted — use hex(col) or length(col). A database with a -wal journal is read from a temporary copy (wal_copy in the response).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
pathYes
limitNoDefault 100, max 1000.
timeout_msNoDefault 5000, max 30000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare read-only/idempotent/non-destructive; the description goes far beyond that by disclosing the statement wrapping (SELECT * FROM (...) LIMIT limit+1), the meaning of the truncated flag, the partial-semicolon rule, rejection of bind parameters, BLOB handling, and the WAL temporary-copy behavior surfaced as wal_copy. This is exactly the extra behavioral context annotations cannot carry.

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?

Every sentence delivers a distinct operational fact and the most load-bearing constraint (read-only, allowed prefixes) is front-loaded. Despite its length, there is no filler or restatement of the title.

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 no output schema, the description carries the return-value burden itself and does so: it explains the wrapping/limit semantics, the truncated flag, and the wal_copy field for WAL databases. An agent has enough to call the tool and interpret results without further context.

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 50%: limit and timeout_ms are documented in the schema, but sql and path are not. The description compensates for sql (allowed prefixes, no placeholders, literal values required, semicolon constraints) and path (a SQLite file, WAL journaling), but never explains timeout_ms, leaving one parameter undocumented in both places.

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 first sentence gives a specific verb, resource, and execution mode ("Run one read-only SQL statement on a SQLite file") and immediately names the enforcement flags (sqlite3 -readonly -safe -json). An agent can distinguish this from the sibling sqlite_schema, which lists schema rather than executing arbitrary queries.

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?

It clearly constrains when the tool applies by enumerating the allowed statement prefixes (SELECT, WITH, VALUES, EXPLAIN) and stating that escapes/pragmas and bind parameters are rejected. It does not, however, route the agent to the sibling sqlite_schema for schema inspection or state what to do when a query is rejected.

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