Repository navigation
fix(mcp): let fetched dashboard filters and tiles be saved and patched back - #3865
karl-power wants to merge 4 commits into
Conversation
clickstack_get_dashboard returned fields such as isBroadcastEnabled and isVariableEnabled on filter types that fix them to one value, and the MCP filter schemas don't declare them, so the output could not be passed back to clickstack_save_dashboard. Omit every field a filter type pins to a literal in DashboardFilterSchema from MCP output. REST output is unchanged.
clickstack_get_dashboard and clickstack_get_dashboard_tile return each tile with its id, but the patch tool's tile schema didn't declare one, so clients that check arguments against the advertised schema rejected a fetched tile. Accept an optional id and reject it when it differs from tileId.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 477c6e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review✅ No issues found. |
E2E Test Results✅ All tests passed • 490 passed • 1 skipped • 1119s
Tests ran across 4 shards in parallel. |
Deep Review✅ No critical issues found. The change is correct and well-covered: the 🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (10): correctness, testing, maintainability, project-standards, agent-native, learnings-researcher, kieran-typescript, api-contract, adversarial, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
Summary
Filters and tiles returned by the MCP dashboard tools can now be passed straight back to save and patch.
clickstack_get_dashboardand theclickstack_save_dashboardresponse no longer return filter fields that the filter type fixes to one value:isBroadcastEnabled/isVariableEnabledon every type except QUERY_EXPRESSION, andminSelections/maxSelectionson DATA_SOURCE and CONNECTION. The save schema doesn't accept them, so strict MCP clients rejected the get output. Saving fills them back in.DashboardFilterSchema(z.literalfields), so new filter types need no change here. REST output is unchanged.clickstack_patch_dashboardaccepts an optionaltile.id, so a fetched tile can be passed back as is. An id that doesn't matchtileIdis rejected.How to reproduce
Starting point:
yarn dev, with an MCP client that validates tool arguments against the advertised schema.On
main:clickstack_get_dashboard, thenclickstack_save_dashboardwith the returnedfiltersunchanged. It fails withfilters.N.isBroadcastEnabled: unknown fieldandfilters.N.isVariableEnabled: unknown field.clickstack_get_dashboard_tile, thenclickstack_patch_dashboardwith the returned tile. It fails withtile.id: unknown field.On this branch:
Without an MCP client:
make dev-int FILE=mcp/__tests__/dashboardspasses here, and the new tests fail onmain.How to test on Vercel preview
N/A — non-UI change
Note
Low Risk
MCP-only serialization and patch validation; persistence behavior unchanged and covered by integration tests.
Overview
Fixes MCP round-trips so agents can pipe get → save/patch without strict clients rejecting unknown fields.
Dashboard filters:
clickstack_get_dashboardand save responses now run filters throughtoMcpOutputFilters, which resolvesvariableNameand strips schema-fixed literals (e.g.isBroadcastEnabled/isVariableEnabledon most types,minSelections/maxSelectionson CONNECTION/DATA_SOURCE) derived fromDashboardFilterSchema. QUERY_EXPRESSION still exposes the mode flags agents can set. Persistence still fills fixed values on save; REST output is unchanged.Tiles:
clickstack_patch_dashboardallows an optionaltile.idwhen it equalstileIdand errors if they differ; the patch input schema documents this for tiles fromclickstack_get_dashboard_tile.Tests: Integration tests assert Ajv validation against advertised tool schemas (
getToolSchemaErrors) for filter and tile round-trips; unit coverage fortoMcpOutputFilters.Reviewed by Cursor Bugbot for commit 477c6e7. Bugbot is set up for automated code reviews on this repo. Configure here.