Skip to main content
Glama

Execute Read-Only SQL Query

unfour.db.query_readonly
Read-onlyIdempotent

Execute read-only SQL queries against a saved database connection. Run SELECT, WITH, SHOW, DESCRIBE, DESC, or EXPLAIN statements while write operations and multi-statement queries are rejected.

Instructions

Executes a read-only SQL query against a saved database connection through the Unfour command bus. Only SELECT, WITH, SHOW, DESCRIBE, DESC, and EXPLAIN statements are allowed. Write operations, DDL, and multi-statement queries are rejected. Optional catalog, schema, and timeoutMs match unfour.db.execute and unfour.db.explain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesRequired SQL query. Only read-only statements are allowed.
limitNoMaximum number of rows to return (default 100, max 1000).
schemaNoOptional schema to resolve unqualified names against.
catalogNoOptional catalog (database) to run the query against.
timeoutMsNoOptional per-statement timeout in milliseconds.
workspaceIdNoOptional workspace ID. Uses the active workspace if omitted.
connectionIdYesRequired saved database connection ID.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
rowsNo
sourceYes
columnsNo
rowCountNo
truncatedNo
durationMsNo
connectionIdYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed3 schema fields changedv0.6.0
    • addedInput schema / properties / catalog
      Added value: +{
      +  "description": "Optional catalog (database) to run the query against.",
      +  "type": "string"
      +}
    • addedInput schema / properties / schema
      Added value: +{
      +  "description": "Optional schema to resolve unqualified names against.",
      +  "type": "string"
      +}
    • addedInput schema / properties / timeoutMs
      Added value: +{
      +  "description": "Optional per-statement timeout in milliseconds.",
      +  "type": "integer"
      +}
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds the specific allowed statement types and the rejection of write/DDL/multi-statement queries, which is useful behavioral context beyond the annotations. It doesn't mention return format, but the output schema exists, so that's covered.

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 with no waste. The core purpose and constraints are front-loaded, and the sibling reference is concise. Every sentence earns its place.

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?

Complete for a read-only query tool. The description covers allowed statements, rejected operations, and parameter alignment with siblings. The output schema exists, so return values are documented. An agent has everything needed to call it correctly.

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 description coverage is 100%, so the schema already documents all 7 parameters. The description adds the note that optional catalog, schema, and timeoutMs match unfour.db.execute and unfour.db.explain, which is a small addition. Baseline 3 is appropriate since the schema does the heavy lifting.

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 states a specific verb ('Executes'), a resource ('read-only SQL query against a saved database connection'), and the allowed statement types. It clearly distinguishes this from unfour.db.execute and unfour.db.explain by naming them as siblings and noting the matching optional parameters.

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?

The description explicitly lists which SQL statements are allowed and which are rejected, and it references sibling tools (unfour.db.execute and unfour.db.explain) for the optional parameters. This gives clear guidance on when to use this tool versus alternatives.

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

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/zyqzyq/Unfour'

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