Repository navigation
fix(mcp): let fetched dashboard filters and tiles be saved and patched back - #3865
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. 2 Skipped Deployments
|
🦋 Changeset detectedLatest commit: fca3a9e 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 • 492 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
Scoped MCP response shaping and patch validation; persistence logic unchanged aside from safer agent round-trips.
Overview
MCP get/save dashboard responses now run filters through
toMcpOutputFilters, which resolves variable names and drops schema-fixed fields (mode flags on most filter types, selection limits on CONNECTION/DATA_SOURCE) so strict clients can feedclickstack_get_dashboardoutput straight intoclickstack_save_dashboardwithout unknown-field errors; QUERY_EXPRESSION filters still expose the configurable mode flags. Fixed fields are derived fromDashboardFilterSchemaliterals—REST behavior is unchanged.clickstack_patch_dashboardaccepts an optionaltile.idon the patch payload (must matchtileId) so tiles fromclickstack_get_dashboard_tileround-trip; mismatched ids are rejected.Test helpers
getToolSchemaErrors(Ajv against advertised tool schemas) and new integration/unit round-trip tests lock in the behavior.Reviewed by Cursor Bugbot for commit fca3a9e. Bugbot is set up for automated code reviews on this repo. Configure here.