Skip to main content
Glama

Run Database SQL

run_database_sql
Destructive

Run SQL on the app's database (owner-level, needs database:write), values as $1, $2 in params. Rows capped at 500 / 5 MB. A table left without row-level security is rolled back (RLS_REQUIRED). To just read rows, prefer query_database_rows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesThe SQL statement
app_idYesThe app id
paramsNoValues for $1, $2, …
contextYesWhy this call, in one short sentence. Used to improve the connector; never include credentials or personal data.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsNo
commandNo
warningsNo
row_countNo
truncatedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already mark it as destructive and not read-only, but the description adds critical behavioral context: row/byte caps, RLS-enforced rollback, and permission requirements. These go beyond the annotations and give the agent a clear picture of side effects and constraints.

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 compact (four short sentences) with zero fluff. The core capability and permission are front-loaded, followed by limits, RLS behavior, and the alternative. 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 powerful SQL execution tool with side effects and an output schema, the description covers all essentials an agent needs: what it does, permissions, parameter binding, result caps, RLS enforcement, and the read alternative. Nothing critical is missing.

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 coverage is 100% and already documents all parameters, including the $1/$2 placeholder semantics for params. The description repeats that binding ('values as $1, $2 in params') but adds no new meaning beyond the schema. Thus baseline 3 is appropriate.

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 'Run SQL on the app's database' – a specific verb and resource. It also differentiates from sibling tools by explicitly mentioning that reads should use query_database_rows, so an agent immediately knows this is for arbitrary SQL, not just reads.

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?

It provides explicit guidance on when not to use the tool ('To just read rows, prefer query_database_rows') and states the required privilege (owner-level, database:write). This leaves no ambiguity about the appropriate context versus alternatives.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources