Skip to content

feat: tag cost-confirmation errors and report caller-input errors as ToolCallerError - #543

Merged
barryroodt merged 17 commits into
mainfrom
barryroodt/tool-error-labels
Nov 12, 2026
Merged

barryroodt merged 17 commits into
mainfrom
barryroodt/tool-error-labels

Conversation

@barryroodt

@barryroodt barryroodt commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature + bug fix.

What is the current behavior?

  • Hosts treat a ToolCallerError as a client error and any other Error as a server error, so client mistakes thrown as plain Error (log-window checks, invalid search_docs queries) count as server errors.
  • Bad arguments and unknown tools fail before the onToolCall hook runs, so hosted MCP logs them as unclassified.

What is the new behavior?

  • ToolCallerError gets an optional kind (new ToolCallerErrorKind type). A mismatched confirm_cost_id in create_project and create_branch, or a missing one when inline cost confirmation is configured, sets kind: 'confirmation_required'.
  • query_logs/get_logs window checks throw ToolCallerError.
  • search_docs GraphQL errors throw ToolCallerError (client error) only when the error has no path and either has locations or is one of the Content API's GET-operation validation messages. Everything else, including the Content API's own outage response, stays a server error.
  • Bad arguments and unknown tools now reach onToolCall as a ToolCallerError (the ZodError is its cause). The MCP client's result doesn't change.

ToolCallerError moves to @supabase/mcp-utils so the mcp-utils server can throw it. @supabase/mcp-server-supabase still exports it with the same brand, so isToolCallerError keeps matching.

@barryroodt barryroodt self-assigned this Nov 10, 2026
@coveralls

coveralls commented Nov 10, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 43246675000

Warning

No base build found for commit 9687d61 on main.
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: 98.069%

Details

  • Patch coverage: 35 of 35 lines across 4 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

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


Coverage Stats

Coverage Status
Relevant Lines: 6225
Covered Lines: 6126
Line Coverage: 98.41%
Relevant Branches: 1337
Covered Branches: 1290
Branch Coverage: 96.48%
Branches in Coverage %: Yes
Coverage Strength: 283.93 hits per line

💛 - Coveralls

@barryroodt
barryroodt marked this pull request as ready for review November 10, 2026 16:46
@barryroodt
barryroodt requested a review from a team as a code owner November 10, 2026 16:46
Comment thread packages/mcp-utils/src/server.ts Resolved

@Rodriguespn Rodriguespn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some inline comments. Also, the mgmt-api spec validation CI job is failing. Could you have the bot to generate one to get this test to pass please?

One nit comment: the comment at graphql.ts:133 ("Schema load failures are server faults, so they stay unbranded") no longer holds. loadSchema sends the server-built { schema } query through #query, so a pathless error there is now a ToolCallerError. Moving the branding into query() (the path that takes caller queries) would keep server-built queries unbranded. It has no metric impact today. Post it as a reply on comment 1 if you want it on record.

@Rodriguespn Rodriguespn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a nit comment. Some things to consider on the equivalent platform PR: narrow the confirmation_required JSDoc like the docs (util.ts:218, util.ts:235); add unknown tools to invalid_request (util.ts:240) and mcp-utils arg-parse failures to validation (util.ts:229).

The platform PR looked good to me. After those land, I'll do a final review over the platform PR. Thx!

@barryroodt
barryroodt merged commit ac366c4 into main Nov 12, 2026
6 of 7 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Nov 12, 2026
@barryroodt
barryroodt deleted the barryroodt/tool-error-labels branch November 12, 2026 15:58
barryroodt pushed a commit that referenced this pull request Nov 13, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>mcp-utils: 0.10.0</summary>

##
[0.10.0](mcp-utils-v0.9.0...mcp-utils-v0.10.0)
(2026-11-13)


### Features

* tag cost-confirmation errors and report caller-input errors as
ToolCallerError ([#543](#543))
([ac366c4](ac366c4))
</details>

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

##
[0.17.0](mcp-server-supabase-v0.16.1...mcp-server-supabase-v0.17.0)
(2026-11-13)


### ⚠ BREAKING CHANGES

* **elicitation:** split confirmation and secret collection TTLs
([#538](#538))

### Features

* agent feedback capabilities including docs
([#488](#488))
([698ccd5](698ccd5))
* **elicitation:** split confirmation and secret collection TTLs
([#538](#538))
([8a08e48](8a08e48))
* tag cost-confirmation errors and report caller-input errors as
ToolCallerError ([#543](#543))
([ac366c4](ac366c4))


### Bug Fixes

* **content api:** report GraphQL errors that have no locations
([#528](#528))
([6b2fca9](6b2fca9))
* **mcp:** confirm UPDATEs without WHERE that have a leading comment,
ONLY or an alias ([#524](#524))
([7df9fb8](7df9fb8))
* **mcp:** don't read semicolons or EXECUTE inside data literals as
destructive SQL ([#533](#533))
([0dcdd2d](0dcdd2d))
* tell agents the log window, project readiness, docs query and SQL size
rules up front ([#542](#542))
([23f0df0](23f0df0))
</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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants