Skip to main content
Glama
Chantichalla

Safe DB Gateway

by Chantichalla

safe_query

Execute read-only SQL queries safely with built-in protections including injection blocking, PII masking, and rate limiting.

Instructions

Safely executes a read-only SQL query against the database.

Guarantees:

  • Anomaly circuit breaker: Tracks security violations and quarantines abusive sessions.

  • Rate limiter: Maximum 30 queries/minute and 15s cumulative compute budget.

  • Static AST validation: Blocks SQL injection, multi-statements, and writable CTEs.

  • Strict table whitelisting.

  • Automatic row limit clamping (max 100 rows).

  • Native execution timeout and memory streaming.

  • Dynamic PII masking on sensitive fields.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It lists concrete guarantees: circuit breaker, rate limiter (30 queries/min, 15s compute), AST validation, whitelisting, row clamping (max 100), timeout, memory streaming, and PII masking. These are meaningful behavioral traits beyond a generic 'read-only' claim. It does not detail error handling or exact response structure, but the presence of an output schema mitigates that gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured: a one-sentence purpose followed by a bulleted list of guarantees. Each bullet is specific and earns its place by adding actionable constraints. It is front-loaded with the core function and avoids redundancy, though the list could be seen as slightly lengthy for a tool with a single parameter.

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 tool with one parameter and an output schema, the description covers the essential operational constraints: safety mechanisms, rate limits, row limits, and PII handling. It does not explain the return shape (covered by output schema) or error behavior in detail, but given the complexity of the safety guarantees, it provides enough context for correct invocation. Missing explicit guidance on when to use it vs. siblings slightly reduces completeness.

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 0%, so the description must compensate. The description indicates that the sql parameter is a SQL query, but it does not add specifics like syntax expectations, whether parameter binding is supported, or how table whitelisting affects query construction. The guarantee of AST validation hints at constraints but leaves the agent to infer the exact input format. Minimal value added beyond the schema's bare type.

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 opens with a clear, specific statement: 'Safely executes a read-only SQL query against the database.' The verb 'executes' and resource 'SQL query' are precise, and the explicit 'read-only' qualifier immediately distinguishes it from the mutation siblings (propose_mutation, apply_mutation). The guarantees reinforce the scope without obscuring the primary purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for any read-only SQL query that needs safety guarantees, but it does not explicitly state when to prefer safe_query over siblings like sample_rows or describe_table. There is no mention of exclusions or alternative tools. The read-only tag and sibling list suggest it is the general-purpose query executor, but the guidance remains implicit rather than explicit.

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