Skip to main content
Glama
dsh-databases

dsh-databases

by nvznc

Ejecutar consulta de solo lectura

run_query
Read-onlyIdempotent

Executes one read-only SQL statement (SELECT/WITH, plus EXPLAIN/SHOW/DESCRIBE on MySQL/Postgres) and returns rows as JSON, with a 200-row default limit and no writes or multi-statement execution.

Instructions

Ejecuta una única sentencia de lectura (SELECT/WITH; en mysql/postgres también EXPLAIN, SHOW o DESCRIBE) y devuelve las filas como JSON. No permite escribir ni varias sentencias. Las filas se limitan a 200 por defecto (máximo 5000). Usa list_tables y describe_table para explorar.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "<sql>"
    },
    "name": "run_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSentencia de lectura. Ejemplo: SELECT TOP 10 * FROM dbo.Clientes ORDER BY id DESC
engineNoMotor de base de datos. Por defecto usa MSSQL_ENGINE del .env (mssql si no existe).
maxRowsNoFilas máximas (por defecto 200).
databaseNoNombre de la base de datos. Si se omite se usa la de la conexión (por defecto master).
connectionNoNombre de la conexión definida en configs/connections.json, guardada con save_connection o "default" (.env). Si se omite se usa la conexión por defecto o la indicada por DSH_MCP_SQL_CONNECTION.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and a closed-world scope, and the description still adds real behavior: results are truncated to 200 rows by default with a 5000 ceiling, only one statement is executed, and rows come back as JSON. That limit/truncation behavior is exactly the kind of side effect an agent needs and is not derivable from the annotations alone.

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 short sentences: capability and return format first, restrictions second, exploration alternatives last. No filler and nothing buried.

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?

For a five-parameter read tool with no output schema and full schema coverage, the definition covers what it does, its read-only limits, its row caps and where to go for exploration. Minor gaps remain: no mention of error/timeout behavior or whether truncation is signaled in the JSON response, which matters at the 200-row default.

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 baseline is 3 and the schema already documents sql, engine, maxRows, database and connection with defaults. The description's added value is the engine-specific statement support (EXPLAIN/SHOW/DESCRIBE only for mysql/postgres) plus the 200/5000 row framing, which the schema partially repeats; it adds no further per-parameter guidance.

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?

States a specific verb and resource ("Ejecuta una única sentencia de lectura ... devuelve las filas como JSON") and enumerates exactly which statement types are permitted per engine. It also separates itself from the exploration siblings by naming list_tables and describe_table, so an agent can pick correctly without opening another schema.

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?

Gives clear routing guidance ("Usa list_tables y describe_table para explorar") and hard exclusions (no writes, no multiple statements). It stops short of covering the other siblings such as list_connections or test_connection, which an agent may also need to pick between, but the core when-to-use signal is explicit.

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