Skip to main content
Glama

ShipRely Security Knowledge

Build a Supabase RLS policy

build_rls_policy
Read-onlyIdempotent

Write Supabase row level security SQL for one table: owner-only, public read with owner writes, team/workspace members, or server-only. Returns the migration, a check query, test scripts and a fix prompt. Every pattern is tested on Postgres; review before running.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "table": "<table>",
      "pattern": "<pattern>"
    },
    "name": "build_rls_policy"
  }
}

Input Schema

NameRequiredDescriptionDefault
tableYesTable name in the public schema: lower-case letters, digits and _, starting with a letter, at most 40 characters.
writesNoWhich writes users may do from the browser. Reading is part of the pattern.
patternYesowner: each user sees only their rows. public-read: everyone reads, owners write. team: members of the row's team. server-only: no browser access.
team_columnNoColumn with the team id, on the table and on the membership table (team): lower-case letters, digits and _, starting with a letter, at most 40 characters.team_id
owner_columnNoColumn with the owner's auth.users id (owner and public-read): lower-case letters, digits and _, starting with a letter, at most 40 characters.user_id
members_tableNoMembership table with user_id and the team column (team): lower-case letters, digits and _, starting with a letter, at most 40 characters.team_members
owner_defaultNoFill the owner column with auth.uid() when an insert leaves it out.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior3/5

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

With readOnlyHint/idempotentHint already declaring a safe, non-executing generator, the description still earns credit for listing the returned artifacts (migration, check query, test scripts, fix prompt) and for the "review before running" warning that the generated SQL is not applied for you. It does not state whether output is dialect-specific beyond Postgres or how large the generated artifacts typically are, so it is helpful 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?

Three tight sentences: capability and pattern list first, return payload second, trust/caveat last. No restatement of the title and 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?

Absent an output schema, the description correctly spends words on what comes back, and parameter documentation is fully covered by the schema, so an agent has enough to call it. Minor gap: nothing says the migration is returned as text meant to be applied manually versus a file path, which matters for a 7-parameter generator.

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 description coverage is 100%, so the baseline is 3; the description adds a small amount by naming the pattern semantics inline ("owner-only, public read with owner writes, team/workspace members, or server-only") and by clarifying the writes dimension implicitly through "owner writes". The remaining parameters (team_column, members_table, owner_default) are left entirely to the schema.

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 and resource ("Write Supabase row level security SQL for one table") and enumerates the four supported patterns, which map one-to-one onto the `pattern` enum. It also bounds scope to a single table, so an agent can distinguish it from sibling policy/knowledge tools without opening the schema.

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 makes the triggering situation clear (you need RLS SQL for a table) and reveals the choice space (owner-only, public read + owner writes, team/workspace, server-only), which effectively tells the caller which pattern to request. It stops short of explicit when-not-to-use guidance or naming an alternative tool such as build_storage_policy.

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