Skip to main content
Glama
AishwaryaDV

safe-db-mcp

by AishwaryaDV

run_query

Executes a single read-only SELECT query against a specified database and returns capped rows; rejects non-read-only statements and may truncate results.

Instructions

Run a single read-only SELECT against a database and get the rows back. The query is rejected if it is not one read-only statement, and results are capped and may be truncated. Call describe_schema first to get exact table and column names.

Input Schema

NameRequiredDescriptionDefault
sqlYes
databaseYes
max_rowsNo

Output Schema

NameRequiredDescriptionDefault
okYes
hintNo
rowsNo
columnsNo
messageNo
row_countNo
truncatedNo
elapsed_msNo
error_typeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the full disclosure burden and does well: it states the read-only enforcement, that multi-statement or non-SELECT queries are rejected, and that results are capped and may be truncated. It omits permission/auth requirements and what the rejection or error shape looks like.

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 tight sentences, front-loaded with the core action, then the constraint, then the prerequisite. No filler, and the truncation caveat is placed before the agent commits to the call.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return-value explanation is not required, and the truncation/cap warning covers the main risk. However, for a 3-parameter tool with zero schema coverage and no annotations, the meaning of 'database' and 'max_rows' is a real gap an agent must guess at.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across three parameters, so the description must compensate and largely does not. It implies the sql parameter must be a single read-only SELECT, but leaves 'database' (which database name, sourced from list_databases?) and 'max_rows' (its interaction with the cap) completely undefined.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence gives a specific verb, resource, and execution mode: a single read-only SELECT returning rows. It is clearly distinct from explain_query (plan only) and describe_schema (metadata only), though the sibling distinction is implied rather than stated.

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 gives a concrete prerequisite: call describe_schema first for exact table and column names, and it constrains use to one read-only statement. It stops short of naming when to prefer explain_query or list_databases instead.

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