Skip to content

fix: hint agents to re-copy malformed project refs - #522

Merged
Rodriguespn merged 3 commits into
mainfrom
Rodriguespn/ai-1425-project-ref-length
Nov 5, 2026
Merged

Rodriguespn merged 3 commits into
mainfrom
Rodriguespn/ai-1425-project-ref-length

Conversation

@Rodriguespn

@Rodriguespn Rodriguespn commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes an unhelpful error when an agent passes a malformed project ref:

  • AI-1425: apply_migration, execute_sql and get_project failed with ref: ref must be exactly 20 characters long after the agent used a 19-character ref. A 19-character ref can't exist. The Management API's zProjectRef requires exactly 20 letters, refs are generated with 20 characters, and list_projects passes refs through unchanged. So the agent most likely truncated the ref, and loosening validation wouldn't help. Now, when the API rejects a ref with a 400 error, the message also tells the agent to copy the ref exactly as list_projects (id) or list_branches (project_ref) returned it, depending on whether it's working with the main project or a branch.

Refs AI-1425

The Management API rejects refs that are not exactly 20 letters with a 400
`ref: ...` validation error. Agents that truncate or mistype a ref (AI-1425)
got only that message. Append a hint to copy the ID verbatim from list_projects.

Co-Authored-By: Claude <[email protected]>
@coveralls

coveralls commented Nov 5, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 42033282586

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.2%) to 97.865%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: 9 of 9 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 6002
Covered Lines: 5904
Line Coverage: 98.37%
Relevant Branches: 1210
Covered Branches: 1154
Branch Coverage: 95.37%
Branches in Coverage %: Yes
Coverage Strength: 259.51 hits per line

💛 - Coveralls

@Rodriguespn
Rodriguespn force-pushed the Rodriguespn/ai-1425-project-ref-length branch from 1a1067a to 6245836 Compare November 5, 2026 12:24
@Rodriguespn Rodriguespn added the publish-preview Runs `publish-preview` workflow to publish preview packages via https://pkg.pr.new/ label Nov 5, 2026
@Rodriguespn
Rodriguespn marked this pull request as ready for review November 5, 2026 12:49
@Rodriguespn
Rodriguespn requested a review from a team as a code owner November 5, 2026 12:49
@pkg-pr-new

pkg-pr-new Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 46aa6be

@barryroodt barryroodt 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.

Looks good! Agree that loosening the validation wouldn't help, since refs are always 20 chars.

Optional nit: branch refs come from list_branches / create_branch (project_ref), so an agent working on a branch gets pointed at the wrong tool. Could we say list_projects or list_branches instead? If we change it, supabase/platform#41332 has the same wording too.

Branch refs come from list_branches/create_branch as project_ref, so the hint
should not send agents working on a branch to list_projects only.

Co-Authored-By: Claude <[email protected]>
@Rodriguespn

Rodriguespn commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Done in 5a1f5cf. The hint now reads: "Copy the ref exactly as returned by list_projects (id) or list_branches (project_ref); do not retype or shorten it." Will do the same change in supabase/platform#41332.

@Rodriguespn
Rodriguespn merged commit 0c650bf into main Nov 5, 2026
6 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Nov 5, 2026
barryroodt pushed a commit that referenced this pull request Nov 5, 2026
🤖 I have created a release *beep* *boop*
---


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

##
[0.16.0](mcp-server-supabase-v0.15.0...mcp-server-supabase-v0.16.0)
(2026-11-05)


### Features

* bound run_notebook cost
([#511](#511))
([e90d110](e90d110))
* **mcp-server-supabase:** run selected notebook cells
([#514](#514))
([8d04248](8d04248))
* **notebooks:** add delete_notebook tool with elicitation confirmation
([#510](#510))
([f36f74a](f36f74a))
* **notebooks:** enable create_notebook and run_notebook tools
([#509](#509))
([addc4e5](addc4e5))


### Bug Fixes

* **feedback:** accept null project_id and surface the feedback length
limit ([#521](#521))
([994f56c](994f56c))
* hint agents to re-copy malformed project refs
([#522](#522))
([0c650bf](0c650bf))
* **notebooks:** return caller errors for client-caused notebook
refusals ([#512](#512))
([5f0d393](5f0d393))
* **pg-meta:** report partition FKs once and add partition_of to
list_tables ([#508](#508))
([2c7fa82](2c7fa82))
* **pg-meta:** return complete check expressions for NOT VALID and NO
INHERIT constraints ([#517](#517))
([c54bb40](c54bb40))
* **sql:** skip destructive confirmation for planner-only EXPLAIN
([#519](#519))
([95745e5](95745e5))
* tolerate non-URL edge function paths in api platform
([#438](#438))
([00d07a4](00d07a4))
</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