Skip to main content
Glama

Supabase Run SQL

supabase_run_sql
Destructive

Run SQL on a Supabase project to apply schema changes or migrations manually; live writes require human approval.

Instructions

Run SQL on a Supabase project (live write, needs human approval).

Use when: applying schema or migrations by hand; backend_deploy applies the spec's migrations for you. Destructive statements (DROP, TRUNCATE, ALTER ... DROP, GRANT/REVOKE on auth, DELETE/UPDATE without WHERE) always need approval. Returns: {ok, data} rows/result, or an approval_required refusal.

Input Schema

NameRequiredDescriptionDefault
refYesSupabase project ref (20-char id from supabase_list_projects, e.g. 'abcdefghijklmnopqrst').
sqlYesSQL to execute. Destructive statements (DROP, TRUNCATE, DELETE/UPDATE without WHERE) always need approval.
approval_idNoApproval id from a previous approval_required refusal; omit on the first call. The human approves out-of-band with `appfactory approve <id>`, then call again with the same arguments and this id.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.1.5
    • addedInput schema / properties / approval_id / description
      Added value: +"Approval id from a previous approval_required refusal; omit on the first call. The human approves out-of-band with `appfactory approve <id>`, then call again with the same arguments and this id."
    • addedInput schema / properties / ref / description
      Added value: +"Supabase project ref (20-char id from supabase_list_projects, e.g. 'abcdefghijklmnopqrst')."
    • addedInput schema / properties / sql / description
      Added value: +"SQL to execute. Destructive statements (DROP, TRUNCATE, DELETE/UPDATE without WHERE) always need approval."
  2. First observedv0.1.1

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false and idempotentHint=false, so the safety profile is partly structured. The description goes further by disclosing the human-approval workflow and enumerating which statement classes (DROP, TRUNCATE, ALTER ... DROP, GRANT/REVOKE on auth, DELETE/UPDATE without WHERE) trigger it, plus the refusal shape — meaningful context the annotations cannot convey.

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?

Four short, front-loaded segments (purpose, use-when, approval rules, return shape) with zero filler. The most decision-relevant information — that this is a live write requiring approval — appears in the first clause.

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 destructive, open-world SQL execution tool, the definition covers purpose, routing to the sibling, approval gating, and the return/refusal shape. An output schema exists so return details are supplementary rather than required, and nothing an agent needs to call this correctly is absent.

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 schema fully documents ref, sql, and approval_id, including the approval-id round-trip. The description adds no syntax, format, or defaulting detail beyond the schema, so the baseline of 3 applies.

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+resource ('Run SQL on a Supabase project') and immediately qualifies scope as a live write needing approval. It also implicitly distinguishes itself from sibling backend_deploy by noting that backend_deploy applies the spec's migrations automatically.

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?

Explicit 'Use when:' clause names the scenario (applying schema or migrations by hand) and names the alternative (backend_deploy) with the condition that selects it. This is exactly the when/when-not/alternative guidance the dimension rewards.

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

Deploy Server

Other Tools