feat(api): support number-tile backgroundChart in the MCP dashboard tools#2510
feat(api): support number-tile backgroundChart in the MCP dashboard tools#2510alex-fedotyev wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: c871684 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds
Confidence Score: 5/5Clean additive schema change with no conversion logic touched and four integration tests covering the new field end-to-end. The change is schema, prompt copy, and tests only — no conversion code was modified. The new field is optional, backward-compatible, and gated to builder number tiles exactly as intended. All four test scenarios (round-trip save, round-trip patch, invalid-type rejection, raw-SQL strip) pass. No regressions are expected. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[MCP Tool Call] --> B{configType?}
B -->|builder| C[mcpNumberTileSchema]
B -->|sql| D[mcpSqlTileSchema]
C --> E[backgroundChart optional\ntype: line or area\ncolor: optional palette token]
D --> F[backgroundChart not in schema\nZod strips unknown fields silently]
E --> G{backgroundChart provided?}
G -->|yes| H{type valid?}
G -->|no| I[Saved without sparkline]
H -->|line or area| J[Tile saved with sparkline]
H -->|other e.g. bar| K[Validation error returned]
F --> L[backgroundChart dropped\ncolor field preserved]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[MCP Tool Call] --> B{configType?}
B -->|builder| C[mcpNumberTileSchema]
B -->|sql| D[mcpSqlTileSchema]
C --> E[backgroundChart optional\ntype: line or area\ncolor: optional palette token]
D --> F[backgroundChart not in schema\nZod strips unknown fields silently]
E --> G{backgroundChart provided?}
G -->|yes| H{type valid?}
G -->|no| I[Saved without sparkline]
H -->|line or area| J[Tile saved with sparkline]
H -->|other e.g. bar| K[Validation error returned]
F --> L[backgroundChart dropped\ncolor field preserved]
Reviews (1): Last reviewed commit: "feat(api): support number-tile backgroun..." | Re-trigger Greptile |
…ools
Add backgroundChart ({ type: line | area, color? }) to the builder
number-tile config in clickstack_save_dashboard and
clickstack_patch_dashboard, reusing BackgroundChartSchema from
common-utils. The MCP tools already share the external-api conversion,
so this is schema + prompt + tests only, no conversion edits.
Builder number tiles only: raw SQL number tiles return a single value
with no time dimension to bucket, so backgroundChart is not on their
schema (a sent value is stripped on save). Mirrors number-tile color in
the MCP tools (#2480).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4b3d2c9 to
c871684
Compare
|
Too many files changed for review. ( Bypass the limit by tagging |
Deep Review✅ No critical issues found. Six reviewers (correctness, maintainability, project-standards, api-contract, TypeScript, agent-native) returned clean. The change is cleanly additive: 🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (8): correctness, testing, maintainability, project-standards, api-contract, kieran-typescript, agent-native, learnings-researcher. Testing gaps:
|
Add
backgroundChartto number tiles in the MCP dashboard tools, so an agent can author the background trend sparkline throughclickstack_save_dashboardandclickstack_patch_dashboard.Stacked on #2509 (the v2 REST parity), which makes the shared conversion backgroundChart-aware. Mirrors the number-tile color MCP work in #2480.
Part of #1360.
Summary
Add
backgroundChart(a requiredtypeoflineorarea, plus an optional palette-tokencolor) to the builder number-tile config in the MCP save and patch tools, reusingBackgroundChartSchemafromcommon-utils. The MCP tools already share the external-api conversion, so this is schema, prompt, and tests only, no conversion edits. Raw SQL number tiles do not expose it (no time dimension to bucket), matching the editor and the REST API.What
backgroundCharttomcpNumberTileSchema.configwith a tool description; the patch tool inherits it viamcpPatchTileSchema.typeoutsideline/area; drop the field on a raw SQL number tile.Test plan
yarn workspace @hyperdx/api lintyarn workspace @hyperdx/api tsc --noEmitmcp/__tests__/dashboards/{saveDashboard,patchDashboard}.test.ts(75 passed)What's NOT in this PR (follow-up)
Note: this is stacked on #2509; review that first. GitHub retargets this to
mainonce #2509 merges.