Skip to content

feat: mark client-caused tool errors as ToolCallerError - #480

Merged
Rodriguespn merged 3 commits into
mainfrom
ai-1356-tool-caller-error
Oct 22, 2026
Merged

Rodriguespn merged 3 commits into
mainfrom
ai-1356-tool-caller-error

Conversation

@Rodriguespn

@Rodriguespn Rodriguespn commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

New public exports from @supabase/mcp-server-supabase: ToolCallerError and isToolCallerError(error). The guard checks a Symbol.for('supabase.mcp.callerError') brand instead of instanceof, so it works across two installed copies of the package and across its CJS and ESM builds. Platform imports both from the package root instead of keeping its own copy.

Tool call errors classified as ToolCallerError (traces sampled):

Tool Error Why it's the client's error
create_project, create_branch Missing confirm_cost_id The client skipped the get_cost → confirm_cost step before creating.
create_project, create_branch confirm_cost_id doesn't match the current cost The client sent a confirmation for a different or outdated cost.
search_docs Query fails to parse The client sent text that isn't valid GraphQL.
search_docs Query fails schema validation (only when validateSchema is on) The client asked for fields or types the docs schema doesn't have.
create_project, pause_project, restore_project, create_branch, delete_branch, merge_branch, reset_branch, rebase_branch, apply_migration, deploy_edge_function, create_edge_function_secret, update_storage_config, create_notebook, submit_feedback, delete_feedback Cannot … in read-only mode. The client called a write tool that read-only mode hides from its tool list.

Everything else stays a plain Error and is kept, including Content API failures (fetch, response parse, upstream GraphQL errors, no data) and a malformed docs schema during validation, which is a server fault. Invalid fields in production search_docs are left as plain Error for now: the production client doesn't validate locally, and mislabelling there only keeps an extra trace.

Related: supabase/platform#40406, which keeps traces for every tool error that isn't a caller error and samples the ones that are.

AI disclosure: implemented with an AI agent (omp, Claude). Pedro Rodrigues is the accountable owner and reviews before merge.

Depends on: #481, which regenerates the Management API types that the check job flags as stale. Rebase this PR after it merges.

Refs AI-1356

@Rodriguespn Rodriguespn added the publish-preview Runs `publish-preview` workflow to publish preview packages via https://pkg.pr.new/ label Oct 22, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@supabase/mcp-server-postgrest@876598f
pnpm add https://pkg.pr.new/@supabase/mcp-server-supabase@876598f
pnpm add https://pkg.pr.new/@supabase/mcp-utils@876598f

commit: 876598f

@coveralls

coveralls commented Oct 22, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 39782966802

Warning

No base build found for commit 82ae592 on ai-1356-regen-mgmt-api-types.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 97.56%

Details

  • Patch coverage: 3 uncovered changes across 1 file (72 of 75 lines covered, 96.0%).

Uncovered Changes

File Changed Covered %
packages/mcp-server-supabase/src/tools/secret-tools.ts 3 0 0.0%
Total (10 files) 75 72 96.0%

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 5651
Covered Lines: 5544
Line Coverage: 98.11%
Relevant Branches: 1069
Covered Branches: 1012
Branch Coverage: 94.67%
Branches in Coverage %: Yes
Coverage Strength: 148.63 hits per line

💛 - Coveralls

@Rodriguespn
Rodriguespn force-pushed the ai-1356-tool-caller-error branch from d01feb6 to 4db23bd Compare October 22, 2026 12:59
@Rodriguespn
Rodriguespn changed the base branch from main to ai-1356-regen-mgmt-api-types October 22, 2026 12:59
@Rodriguespn
Rodriguespn force-pushed the ai-1356-tool-caller-error branch from 4db23bd to f22e305 Compare October 22, 2026 13:00
Rodriguespn added a commit that referenced this pull request Oct 22, 2026
The Management API spec added two Realtime advisor lint names,
`realtime_authorization_timeouts` and `realtime_postgres_changes_spike`,
to the lint `name` enum.

This updates `V1ProjectAdvisorsResponse_Output` in
`management-api/types.ts` and both lint unions in
`management-api-v2/types.ts`. It fixes the stale-types `check` failure
on #480.

Refs AI-1356
Rodriguespn and others added 3 commits October 22, 2026 17:00
Throw ToolCallerError for missing or mismatched confirm_cost_id in
create_project/create_branch and for invalid GraphQL queries, and export
isToolCallerError, which checks a Symbol.for brand so hosts can recognize
caller errors across package copies.

Refs AI-1356

Co-authored-by: Claude Opus 5.5 <[email protected]>
Throw ToolCallerError for every read-only mode denial, and brand only
the caller's GraphQL query parse and validation errors so a malformed
server schema stays a server fault. Check that onToolCall receives the
branded error and that the brand matches across the packed CJS and ESM
builds.

Refs AI-1356
@Rodriguespn
Rodriguespn force-pushed the ai-1356-tool-caller-error branch from f22e305 to 876598f Compare October 22, 2026 14:00
@Rodriguespn
Rodriguespn changed the base branch from ai-1356-regen-mgmt-api-types to main October 22, 2026 14:00
@Rodriguespn
Rodriguespn marked this pull request as ready for review October 22, 2026 14:03
@Rodriguespn
Rodriguespn requested a review from a team as a code owner October 22, 2026 14:03
@Rodriguespn
Rodriguespn merged commit 4a619c1 into main Oct 22, 2026
4 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Oct 22, 2026
Rodriguespn pushed a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>mcp-server-supabase: 0.15.0</summary>

##
[0.15.0](mcp-server-supabase-v0.14.0...mcp-server-supabase-v0.15.0)
(2026-10-29)


### Features

* `submit_feedback` and `delete_feedback` tools
([#474](#474))
([f50318a](f50318a))
* mark client-caused tool errors as ToolCallerError
([#480](#480))
([4a619c1](4a619c1))
* **mcp-server-supabase:** detect instant elicitation cancels
([#483](#483))
([5ad1a2a](5ad1a2a))


### Bug Fixes

* **mcp-server-supabase:** return a tool error when a confirmation
expires ([#490](#490))
([5ab9a98](5ab9a98))
* **mcp-server-supabase:** use POSIX path resolution for edge function
filenames ([#393](#393))
([55d2d24](55d2d24))
* **mcp:** don't split an UPDATE on a semicolon inside a dollar-quoted
value ([#482](#482))
([9f07410](9f07410))
* **mcp:** don't split an UPDATE on a semicolon inside a quoted value
([#459](#459))
([6d93b50](6d93b50))
* **pg-meta:** order list_tables columns by ordinal position
([c242e63](c242e63))
* **pg-meta:** order primary key columns by key position and exclude
INCLUDE columns ([#382](#382))
([25d357c](25d357c))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

publish-preview Runs `publish-preview` workflow to publish preview packages via https://pkg.pr.new/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants