Repository navigation
fix(mcp): let fetched dashboard filters and tiles be saved and patched back - #3865
karl-power wants to merge 2 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: 0eb302a 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 • 479 passed • 1 skipped • 1162s
Tests ran across 4 shards in parallel. |
Deep Review✅ No critical issues found. The change is correct and the round trip is lossless: every field stripped from MCP output ( 🟡 P2 — recommended
🔵 P3 nitpicks (3)
Pre-existing (not counted toward verdict):
Reviewers (7): correctness, testing, maintainability, api-contract, kieran-typescript, adversarial, project-standards. 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 |
| '@hyperdx/api': patch | ||
| --- | ||
|
|
||
| fix: MCP dashboard filters from `clickstack_get_dashboard` can be saved back with `clickstack_save_dashboard` unchanged. MCP output now leaves out the fields a filter type fixes to one value (the mode flags on every type but QUERY_EXPRESSION, and the selection limits on data source and connection variables), which the save schema rejects. |
There was a problem hiding this comment.
is 2 changesets intentional?
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 serialization and patch validation fixes with broad integration tests; REST API output is unchanged and persistence behavior is preserved.
Overview
MCP dashboard get and save responses now run filters through
toMcpOutputFilters, which drops schema-fixed fields (isBroadcastEnabled/isVariableEnabledon non–query-expression types, and selection limits on connection/data-source filters) so agents can passclickstack_get_dashboardoutput straight intoclickstack_save_dashboardwithout strict clients rejecting extra keys.QUERY_EXPRESSIONfilters still expose the mode flags agents can set; save continues to backfill fixed values in storage.clickstack_patch_dashboardaccepts an optionaltile.idon the patch payload (must matchtileId) so tiles from get tools round-trip unchanged; mismatched ids are rejected.Tests add
getToolSchemaErrors(Ajv against advertised tool schemas) and integration coverage for filter and tile round trips.Reviewed by Cursor Bugbot for commit 0eb302a. Bugbot is set up for automated code reviews on this repo. Configure here.