Repository navigation
feat: group lints in get_advisors response - #390
mattrossman merged 7 commits into
Conversation
get_advisors response
Coverage Report for CI Build 33521185464Coverage increased (+0.07%) to 96.592%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
…roup-lints-in-get_advisors-to-reduce-response-bloat
commit: |
|
I tested this against Base I used the same 301 advisor findings on both sides and asked the agent to fetch both security and performance advisors, then return every group with its count, severity, and a sample object. The Base response was about 178k characters, while the grouped PR response was about 41k.
On Base, none of the attempts managed to return the complete summary within the result budget. With this PR, all 12 did. The grouping helped a lot here. |
barryroodt
left a comment
There was a problem hiding this comment.
The payload reduction looks like a clear win. I’ve left two comments before approval: only group responses with the shape we expect, and cover grouping through the real get_advisors path.
Mapping missing fields and explicit nulls to the same sentinel let unrelated lints collapse into one group.
Existing get_advisors tests only used empty lint lists, so removing the groupAdvisorsResult call would still pass.
…roup-lints-in-get_advisors-to-reduce-response-bloat
🤖 I have created a release *beep* *boop* --- <details><summary>mcp-utils: 0.8.0</summary> ## [0.8.0](mcp-utils-v0.7.0...mcp-utils-v0.8.0) (2026-09-04) ### Features * **mcp:** add project cost confirmation elicitation ([#391](#391)) ([fb50882](fb50882)) * **mcp:** hide legacy cost tools from form-capable clients ([#411](#411)) ([2f04461](2f04461)) </details> <details><summary>mcp-server-supabase: 0.12.0</summary> ## [0.12.0](mcp-server-supabase-v0.11.0...mcp-server-supabase-v0.12.0) (2026-09-04) ### Features * group lints in `get_advisors` response ([#390](#390)) ([48d593a](48d593a)) * **mcp:** add branch cost confirmation elicitation ([#394](#394)) ([867a160](867a160)) * **mcp:** add project cost confirmation elicitation ([#391](#391)) ([fb50882](fb50882)) * **mcp:** hide legacy cost tools from form-capable clients ([#411](#411)) ([2f04461](2f04461)) ### Bug Fixes * ensure correct escaping in advisor ([#407](#407)) ([a6cf4a0](a6cf4a0)) * make server instructions intent-based instead of naming tools ([#372](#372)) ([fc54ea2](fc54ea2)) </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>
Problem
get_advisorsreturns a list with one object per finding, each carrying the same keys. The lint SQL emitstitle,descriptionandremediationas literals on each row, so 300 instances of the same lint means those same three strings 300 times.See diagnosis thread with metrics demonstrating that is is the longest tail context hog in studio's AI Assistant.
Fix
Groups findings by lint.
findingslist on thelintsentry, with conveniencecountcache_key, which primarily exists for the dashboard UIBefore
{ "lints": [ { "name": "lint_a", "title": "…", "level": "WARN", "facing": "…", "categories": ["…"], "description": "…", "remediation": "…", "detail": "… object_1 …", "metadata": { "name": "object_1" }, "cache_key": "…" }, { "name": "lint_a", "title": "…", "level": "WARN", "facing": "…", "categories": ["…"], "description": "…", "remediation": "…", "detail": "… object_2 …", "metadata": { "name": "object_2" }, "cache_key": "…" }, { "name": "lint_a", "title": "…", "level": "WARN", "facing": "…", "categories": ["…"], "description": "…", "remediation": "…", "detail": "… object_3 …", "metadata": { "name": "object_3" }, "cache_key": "…" }, { "name": "lint_a", "title": "…", "level": "WARN", "facing": "…", "categories": ["…"], "description": "…", "remediation": "…", "detail": "… object_4 …", "metadata": { "name": "object_4" }, "cache_key": "…" }, { "name": "lint_a", "title": "…", "level": "WARN", "facing": "…", "categories": ["…"], "description": "…", "remediation": "…", "detail": "… object_5 …", "metadata": { "name": "object_5" }, "cache_key": "…" }, // ...296 more, each repeating the same 7 shared fields ]}After
{ "lints": [ { "name": "lint_a", "title": "…", "level": "WARN", "facing": "…", "categories": ["…"], "description": "…", "remediation": "…", "count": 301, "findings": [ { "detail": "… object_1 …", "metadata": { "name": "object_1" } }, { "detail": "… object_2 …", "metadata": { "name": "object_2" } }, { "detail": "… object_3 …", "metadata": { "name": "object_3" } }, { "detail": "… object_4 …", "metadata": { "name": "object_4" } }, { "detail": "… object_5 …", "metadata": { "name": "object_5" } }, // ...296 more ] } ]}In the turn cited above, the response shrinks to 293,485 chars, ~73k tokens.
How to review
Take a look at the new tests to understand the expecting grouping behavior.
Point an MCP client at the preview build below then call
get_advisorsfor a project with some advisors, and observe the shape.Screenshot from my testing in MCP Inspector:
Follow-ups
detailis only included per-finding becausepg-metaputs index names, policy names, roles and actions in prose instead ofmetadata. If we fill those in,detailcould be dropped entirely, making that same payload ~4x smallertools/listoutput is untouched so no ChatGPT resubmission needed.Closes AI-1136