Skip to content

fix: Add missing numberFormats, compareToPreviousPeriod fields to MCP Schemas#2445

Merged
kodiakhq[bot] merged 2 commits into
mainfrom
drew/add-missing-tile-formats
Jun 11, 2026
Merged

fix: Add missing numberFormats, compareToPreviousPeriod fields to MCP Schemas#2445
kodiakhq[bot] merged 2 commits into
mainfrom
drew/add-missing-tile-formats

Conversation

@pulpdrew

@pulpdrew pulpdrew commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a few missing display properties to the MCP schemas, so that the agent can use them, and so that they're not stripped when the agent edits an existing dashboard.

  • Tile-level number formats
  • Number format on Raw SQL Charts
  • Compare to Previous Period on line charts

Screenshots or video

The agent can now create and update dashboards leveraging all of these fields:

Screenshot 2026-06-11 at 8 17 48 AM Screenshot 2026-06-11 at 8 25 37 AM Screenshot 2026-06-11 at 8 27 25 AM Screenshot 2026-06-11 at 8 21 18 AM

How to test on Vercel preview

This can be tested locally by connecting to MCP and requesting the agent creates and updates dashboards with these properties.

References

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Jun 11, 2026 2:39pm
hyperdx-storybook Ready Ready Preview, Comment Jun 11, 2026 2:39pm

Request Review

@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ad89110

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/otel-collector Patch

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

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 1
  • Production lines changed: 178 (+ 209 in test files, excluded from tier calculation)
  • Branch: drew/add-missing-tile-formats
  • Author: pulpdrew

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds missing display properties (numberFormat, compareToPreviousPeriod, fitYAxisToData) to the MCP dashboard input schemas so that LLM agents can set them and they are no longer silently stripped on round-trips. Corresponding round-trip integration tests verify each new field is persisted and survives a save → get → update → re-get cycle.

  • numberFormat (tile-level) is added to all five builder tile types (line, stacked_bar, table, number, pie) and to the unified SQL tile schema; all these fields already exist in the underlying external API schemas so no schema drift is introduced.
  • compareToPreviousPeriod and fitYAxisToData are added to both the builder line tile and the SQL tile schema (where they are documented as line-only and silently ignored for other display types, consistent with the external API's externalDashboardLineChartConfigSchema).
  • Description strings are refactored into shared constants (seriesLevelNumberFormatDescription, tileLevelNumberFormatDescription) to clearly distinguish per-series vs tile-level formatting for the LLM context.

Confidence Score: 5/5

Safe to merge. All added fields map 1-to-1 to existing fields in the external API schemas, so nothing new can be persisted that the underlying storage layer doesn't already support.

Every newly exposed MCP field (numberFormat on bar/table/pie/sql tiles; compareToPreviousPeriod and fitYAxisToData on line and SQL tiles) was already declared in the corresponding externalDashboard*ChartConfigSchema in zod.ts, confirmed in the code. The MCP layer simply passes through to those schemas, so there is no persistence path that isn't already exercised. The two new integration tests exercise the full save → get → update → re-get round-trip for all added fields.

No files require special attention.

Important Files Changed

Filename Overview
packages/api/src/mcp/tools/dashboards/schemas.ts Adds tile-level numberFormat to all builder tile schemas and numberFormat/compareToPreviousPeriod/fitYAxisToData to the SQL tile schema; all fields align with the underlying external API schemas in zod.ts.
packages/api/src/mcp/tests/dashboards/saveDashboard.test.ts Adds two comprehensive round-trip tests (SQL tiles and builder tiles) covering save → get → update → re-get for every newly added display field.
.changeset/curvy-foxes-give.md Patch-level changeset entry for the @hyperdx/api package; correctly scoped.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[LLM Agent sends tile config] --> B{configType?}
    B -- sql --> C[mcpSqlTileSchema\n+ numberFormat\n+ compareToPreviousPeriod\n+ fitYAxisToData]
    B -- builder --> D{displayType?}
    D -- line --> E[mcpLineTileSchema\n+ numberFormat\n+ compareToPreviousPeriod\n+ fitYAxisToData]
    D -- stacked_bar --> F[mcpBarTileSchema\n+ numberFormat]
    D -- table --> G[mcpTableTileSchema\n+ numberFormat]
    D -- number --> H[mcpNumberTileSchema\nnumberFormat already present]
    D -- pie --> I[mcpPieTileSchema\n+ numberFormat]
    C --> J[createDashboardBodySchema.safeParse\nexternal API validation]
    E & F & G & H & I --> J
    J -- line SQL/builder --> K[Persists numberFormat\n+ compareToPreviousPeriod\n+ fitYAxisToData]
    J -- non-line displayType --> L[compareToPreviousPeriod /\nfitYAxisToData silently dropped\nby external schema strip mode]
    K & L --> M[convertExternalTilesToInternal\nDB save]
Loading

Reviews (3): Last reviewed commit: "Merge branch 'main' into drew/add-missin..." | Re-trigger Greptile

Comment thread packages/api/src/mcp/tools/dashboards/schemas.ts Outdated
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

All tests passed • 201 passed • 3 skipped • 1309s

Status Count
✅ Passed 201
❌ Failed 0
⚠️ Flaky 2
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

@kodiakhq kodiakhq Bot merged commit 9a7e392 into main Jun 11, 2026
18 checks passed
@kodiakhq kodiakhq Bot deleted the drew/add-missing-tile-formats branch June 11, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP save_dashboard silently drops numberFormat/compareToPreviousPeriod on raw-SQL tiles

2 participants