Skip to main content
Glama
Chantichalla

Safe DB Gateway

by Chantichalla

Database Gateway

Quickstart · Tools · Access Control · Security · Contributing · License

License: Apache-2.0 Python 3.10+ MCP Version Tests

AI agents need database access, but a raw connection lets them leak PII, wreck schema, or obey injected instructions. This gateway sits between the agent and Postgres — reads are validated and masked, writes need a human, and every action is audited.

Quickstart

Prerequisites: Python 3.10+, Docker.

pip install -r requirements.txt
python setup.py init --demo
python setup.py up

Paste the printed block from mcp-servers.json into Claude Desktop. Or install directly:

pipx install git+https://github.com/Chantichalla/Database-MCP.git
database-gateway

Own database? python setup.py init (wizard) or set DB_HOST / DB_PORT / DB_NAME with DB_SEED=empty.

Related MCP server: MCPBridge

Tools

Tool

Access

Description

safe_query

all

Validated read-only SQL. Max 100 rows, 2s timeout, PII masked

list_accessible_tables

all

Allowed tables with row estimates

describe_table

all

Columns, types, primary and foreign keys

sample_rows

all

Up to 3 masked sample rows

propose_mutation

editor, admin

Dry-run plan + expiring token. Executes nothing

apply_mutation

admin

Executes a proposal with the operator key

get_gateway_health

all

Health, quarantine state, quotas

get_audit_summary

all

Recent audit events

reset_quarantine

admin

Clear quarantine without restart

Access Control

One line in roles.yaml sets the deployment's access level:

Role

Reads

Propose

Approve

Manage

reader

✅

❌

❌

❌

editor

✅

✅

❌

❌

admin

✅

✅

✅

✅

Enforced twice — at the tool layer and by dedicated Postgres roles. Invalid config fails closed to reader.

Security

  • SQL validated by AST: SELECT-only, table whitelist, dangerous functions blocked

  • PII masked in a security-barrier view, before any SQL function sees the data

  • 3 violations → 15-minute write quarantine (reads keep working, survives restarts)

  • Writes need a human operator key plus a 5-minute single-use token

  • Append-only audit log; credentials scrubbed from all logs and errors

  • See SECURITY.md for reporting vulnerabilities

Testing

$env:PYTHONPATH='C:\DB_MCP'   # or export PYTHONPATH=/path/to/repo
python tests/test_chinook_gateway.py   # 28 end-to-end tests, live Postgres
python -m unittest discover -s tests

Configuration

File

Purpose

.env

Connection strings, secrets, thresholds. Never committed

roles.yaml

Role definitions and table grants

docker-compose.yml

Local Postgres 16 stack with demo data

License

Apache-2.0. See LICENSE.

Available Tools

9 tools
apply_mutationA

Authenticated Human-in-the-Loop (HITL) Execution Tool: Executes a previously vetted mutation proposal IF AND ONLY IF a valid operator approval key is provided. The LLM cannot self-approve; a human administrator must provide the secret key.

ParametersJSON Schema
NameRequiredDescriptionDefault
proposal_tokenYes
operator_approval_keyYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the critical authorization requirement (human key) and the fact that the LLM cannot self-approve, which is valuable. However, it does not mention what happens on invalid key, whether the operation is destructive or reversible, or any side effects. For a mutation tool, this is a moderate disclosure but not exhaustive.

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?

The description is two sentences with no filler. The purpose and the critical condition are front-loaded, and the human-in-the-loop constraint is stated directly. Every sentence earns its place, making it highly concise and well-structured.

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?

An output schema exists, so return values need not be explained. The description covers the essential usage constraints (approval key, previous vetting). However, it does not explicitly mention the need to obtain a proposal token via propose_mutation, which is a logical prerequisite. Given the sibling list, this is inferable, so the completeness is high but not perfect.

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. It gives meaning to proposal_token as a 'previously vetted mutation proposal' and operator_approval_key as a 'secret key' provided by a human administrator. This goes beyond the bare property names, but it does not explain where to obtain the proposal_token (e.g., from propose_mutation) or the format of the key. The semantics are partially explained but not fully.

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 clearly states the tool's purpose: it executes a previously vetted mutation proposal, with a strict condition (valid operator approval key). This is a specific verb+resource+condition, and it distinguishes itself from the sibling propose_mutation by focusing on execution rather than proposal creation.

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?

The description implies the workflow: use this tool when you have a proposal_token and an operator_approval_key. It states that the LLM cannot self-approve, indicating that human approval is required, but it does not explicitly name propose_mutation as the source of the token or contrast with alternatives like reset_quarantine. The context is clear but not fully explicit about the prerequisite step.

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

describe_tableB

Returns column names, data types, and primary key constraints for an accessible table.

ParametersJSON Schema
NameRequiredDescriptionDefault
table_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the behavioral burden. It communicates a read-only metadata operation via 'Returns' and notes the access prerequisite. It does not address error handling, permission details, or edge cases, but for a simple metadata call this is largely adequate.

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?

One tight sentence, front-loaded with the action, and includes the key constraint ('accessible table') without filler.

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?

Given that an output schema exists and there is only one simple parameter, the description covers the essential invocation context. A pointer to list_accessible_tables would help, but that is more usage guidance than a completeness gap.

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 single table_name parameter is self-explanatory and the description clarifies that it identifies an accessible table. However, it doesn't document naming conventions, schema qualification, or case sensitivity.

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 description clearly states a specific action and resource: returning column names, data types, and primary key constraints for a table. It is more specific than just 'describe table,' but it does not explicitly distinguish itself from siblings like list_accessible_tables or sample_rows.

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

Usage Guidelines2/5

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

The phrase 'for an accessible table' implies a prerequisite but gives no when-to-use guidance. It does not mention that list_accessible_tables could provide candidate tables or that safe_query/sample_rows serve different purposes.

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

get_audit_summaryA

Read-only audit summary: returns the last N gateway audit events.

Lets the operator ask 'what happened in the last 10 minutes' without opening files manually.

ParametersJSON Schema
NameRequiredDescriptionDefault
nNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior3/5

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

The description begins with 'Read-only' and states it returns events, which is useful since no annotations are provided. It does not disclose additional behaviors such as ordering, time range interpretation, or potential errors (e.g., what happens when N exceeds available events). It covers the core safety aspect but leaves other behavioral details to inference.

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?

The description is two sentences with zero waste. The core purpose is front-loaded, and the use case is added in a natural second sentence. It is appropriately concise for a simple tool.

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?

Given the tool has an output schema, return values are already documented. The description covers the essential information: what it returns, the read-only nature, and a typical usage scenario. It omits details like event ordering or time window assumptions, but these are minor given the output schema and the straightforward parameter.

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 0%, so the description is the only source for parameter meaning. It says 'last N' which implies the 'n' parameter controls the count of events. This adds meaning beyond the bare integer schema, though it does not explicitly label the parameter or discuss constraints like bounds or default behavior.

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 explicitly states the tool's action ('returns the last N gateway audit events') and resource ('gateway audit events'). It distinguishes itself from siblings like get_gateway_health (health status) and safe_query (generic query) by focusing on audit data. The read-only label further clarifies its scope.

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 provides a clear use case: 'Lets the operator ask what happened in the last 10 minutes' – giving context on when to use it. However, it does not explicitly name alternatives or state when NOT to use it (e.g., for arbitrary queries). The scenario is helpful but not fully explicit about exclusions.

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

get_gateway_healthA

Returns the real-time health, anomaly circuit breaker state, and quota usage of the database gateway.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior3/5

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

No annotations are provided, and the description legitimately conveys that this is a read-only, real-time status retrieval. However, it omits additional behavioral context such as authentication requirements, potential latency, or what happens if the gateway is unhealthy.

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?

A single, information-dense sentence with no filler. It front-loads the action ('Returns') and itemizes the key data areas.

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?

For a zero-parameter, read-only health probe with an output schema available, the description names all relevant result categories and leaves nothing essential missing.

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?

The tool has zero parameters, which makes parameter semantics trivial. Per the rubric, the baseline is 4, and the description adds no unnecessary parameter noise.

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?

Description uses 'Returns' with a specific resource: real-time health, anomaly circuit breaker state, and quota usage of the database gateway. This clearly distinguishes it from sibling query/mutation tools.

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?

The description implies a diagnostics/health-check context but does not explicitly state when to choose it over alternatives or mention exclusions. Since no sibling performs gateway health checks, the context is clear enough.

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

list_accessible_tablesA

Lists the tables the agent is permitted to query, along with descriptions. Prevents the LLM from hallucinating queries against internal/restricted tables.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior3/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 states the tool lists permitted tables and descriptions and frames its purpose as preventing hallucination, which is a useful behavioral trait. It doesn't mention authentication, rate limits, or side effects, but for a simple read-only discovery tool with an output schema, this is acceptable but not rich.

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?

Two sentences with no wasted words. The primary action is front-loaded, and the second sentence adds a clear rationale for using the tool. It is compact and efficient.

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?

Given the tool's simplicity (no parameters) and the presence of an output schema, the description is largely complete. It clearly states what it lists and why it matters. It could be slightly more explicit about when to call it relative to siblings, but it's adequate for an agent to understand its role.

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?

The tool has zero parameters, so the baseline is 4. The description correctly says nothing about parameters, which is appropriate. The schema coverage is 100% (empty properties), and there is nothing to compensate for.

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 ('Lists') and resource ('tables the agent is permitted to query') with an explicit purpose. It clearly distinguishes itself from siblings like safe_query (querying) and describe_table (describing a specific table) by focusing on the enumeration of allowed tables.

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?

The description conveys when to use it by explaining it prevents hallucinating queries against internal/restricted tables, implying it should be used before querying to know which tables are allowed. However, it doesn't explicitly name alternatives or state 'use this before safe_query', leaving some routing to inference.

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

propose_mutationA

Human-in-the-Loop (HITL) Proposal Tool: Submits a proposed data mutation (INSERT, UPDATE, DELETE) for review. Does NOT execute the mutation. Generates a proposal token and dry-run query plan.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/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 behavioral burden. It discloses the critical safety property that the tool does not execute the mutation, and it also describes what the tool generates: a proposal token and a dry-run query plan. It does not cover the downstream review/approval workflow, but the most important behavior is transparent.

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 declarative sentences deliver the purpose, the key negative behavior, and the generated outputs without filler. The HITL context is front-loaded, and every sentence earns its place.

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 one-parameter tool with an output schema, the description covers the essential behavior and output artifacts well. It is slightly thin on how the returned proposal token is meant to be used downstream and on SQL parameter constraints, but nothing critical is missing for an agent to decide to use this tool over apply_mutation.

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?

The schema only declares a string parameter named sql with no description, so the description's mention of 'INSERT, UPDATE, DELETE' and 'dry-run query plan' adds meaning about the expected SQL content. However, it does not elaborate on syntax, limits, or which SQL forms are rejected, and with 0% schema description coverage the parameter semantics are only partially compensated.

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 opening line names the tool as a 'Human-in-the-Loop (HITL) Proposal Tool' and states it 'submits a proposed data mutation' for review, listing INSERT, UPDATE, and DELETE. The explicit 'Does NOT execute the mutation' distinguishes it from sibling apply_mutation and makes its role unmistakable.

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?

The description clearly establishes the intended context: use this tool to propose a mutation for review, not to execute one. The negative clause 'Does NOT execute' implies the alternative, but it does not explicitly name apply_mutation or state a firm when-not condition, so it stops short of full guidance.

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

reset_quarantineA

Management tool (admin role only): clears the session quarantine.

Lets the owner recover the gateway without restarting the process. Never gated by the circuit breaker itself.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden, and it delivers: it discloses the admin authorization requirement, the mutation of quarantine state, the fact that it avoids a process restart, and the notable exception that it is never gated by the circuit breaker.

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, with the core action and authorization front-loaded, followed by two high-value behavioral clarifications. 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?

For a zero-parameter admin reset tool with an output schema, the description covers role, action, operational effect, and an important gating exception. Nothing essential is missing for an agent to invoke it correctly.

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?

The tool has zero parameters and 100% schema coverage, so the description has no parameter burden. The baseline of 4 applies because there is simply nothing to explain.

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 and resource: 'clears the session quarantine.' It also explains the practical outcome: letting the owner recover the gateway without restarting, which distinguishes it from the read/query and mutation siblings.

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 establishes the admin-only context and the recovery scenario, giving the agent a strong sense of when to call it. It does not explicitly name alternatives or exclusions, so it falls just short of a 5.

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

safe_queryA

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

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.

sample_rowsA

Returns up to 3 representative rows from an accessible table. Lets the agent see real data shapes before writing queries. Same read pipeline as safe_query: throttle gate, whitelist, role read-scope, AST validation, PII masking, audit.

ParametersJSON Schema
NameRequiredDescriptionDefault
table_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior5/5

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

Even though no annotations are present, the description carries its own behavioral disclosure: it is a read-only operation sharing safe_query's pipeline and lists throttle gate, whitelist, role read-scope, AST validation, PII masking, and audit. This tells the agent the operation is logged, permission-scoped, rate-limited, and PII-masked without relying on annotations.

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, front-loaded with the core behavior, followed by purpose and safety context. Every sentence adds distinct value and there is no filler.

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?

The tool is simple and an output schema exists, so return-value detail is not required. The description covers behavior, constraints, and purpose. It leaves minor gaps such as what happens for empty tables or invalid table_name, but these are not critical for selection.

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?

The only parameter, table_name, is self-explanatory and the description adds an accessibility constraint ('accessible table'), but it gives no format or qualification guidance and no explicit pointer to list_accessible_tables for valid values. With 0% schema description coverage, the description compensates only partially.

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 opening sentence states a specific verb ('Returns'), a precise resource ('up to 3 representative rows from an accessible table'), and clearly separates this from siblings like describe_table and safe_query: it surfaces real data shapes rather than schema or query results. There is no ambiguity about what the tool does.

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 explicitly frames the tool as a pre-query step ('see real data shapes before writing queries'), which is a clear use case. It does not spell out when not to use it or name alternatives beyond the shared pipeline with safe_query, so it falls just short of a 5.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 9 tool updatesv0.1.0
    • First observedapply_mutation
    • First observeddescribe_table
    • First observedget_audit_summary
    • First observedget_gateway_health
    • First observedlist_accessible_tables
    • First observedpropose_mutation
    • First observedreset_quarantine
    • First observedsafe_query
    • First observedsample_rows

TDQS

A4.1/5.0

Scored across 9 tools

Disambiguation5/5

Each tool maps to a clearly distinct responsibility: health, read querying, schema/metadata inspection, sampling, mutation proposal, mutation execution, audit, and quarantine recovery. The phase separation between propose_mutation and apply_mutation is especially unambiguous.

Naming Consistency4/5

Most tools follow a verb_noun snake_case pattern (get_, list_, describe_, sample_, propose_, apply_, reset_). safe_query is the one exception because it is an adjective-noun phrase rather than a verb-first action, but it is still clear and consistent in style.

Tool Count5/5

Nine tools is well-scoped for a database gateway. Each tool covers a distinct part of the workflow without redundancy, and no tool feels like filler.

Completeness5/5

The set covers the full intended lifecycle: read-only querying, table discovery, schema inspection, data sampling, HITL mutation proposal and approval-gated execution, health monitoring, audit, and quarantine recovery. Minor optional additions like proposal listing are not necessary for the core workflow.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to safely explore, analyze, and maintain PostgreSQL databases with read-only mode by default, SQL injection prevention, query performance analysis, and optional write operations.
    37 npm
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Connects AI assistants to PostgreSQL databases with production-grade safety features including query validation, guarded writes, rate limiting, and audit logging.
    3
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI assistants to securely interact with PostgreSQL databases, offering 30+ tools, role-based access control, and security guardrails.
    2
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to query a Postgres data warehouse through a governed, read-only SQL interface with policy enforcement, row limits, schema-level PII isolation, and a full audit trail.
    1
    -