Skip to content

feat(mcp): expose table tile alternateRowBackground in dashboard authoring schema#2718

Open
alex-fedotyev wants to merge 1 commit into
alex/HDX-4602-table-tile-alternate-row-external-apifrom
alex/HDX-4603-table-tile-alternate-row-mcp
Open

feat(mcp): expose table tile alternateRowBackground in dashboard authoring schema#2718
alex-fedotyev wants to merge 1 commit into
alex/HDX-4602-table-tile-alternate-row-external-apifrom
alex/HDX-4603-table-tile-alternate-row-mcp

Conversation

@alex-fedotyev

Copy link
Copy Markdown
Contributor

Summary

Stacked on #2698 (external Dashboards API); merge that first. Adds alternateRowBackground to the MCP clickstack_save_dashboard builder table tile schema and a short prompt guidance line, so AI-authored dashboards can turn on zebra striping. The MCP save path validates and converts through the external dashboard schema, so the field only persists once #2698 lands.

  • schemas.ts: adds the optional boolean to mcpTableTileSchema.config, next to groupByColumnsOnLeft.
  • content.ts: one guidance sentence appended to the existing inventory-style-tables rule.
  • Handler round-trip test: the multi-tile create test now sends and asserts alternateRowBackground: true on the returned builder table tile.

Open question for review: expose it on the raw SQL MCP tile schema too?

I kept this to the builder table tile (mcpTableTileSchema) for now. Worth a second opinion though: alternateRowBackground lives on the shared chart-settings schema, so #2698 exposes it on both the builder and raw SQL external table configs, and the app (from #2519) applies striping to raw SQL table tiles as well.

mcpSqlTileSchema already carries numberFormat, color, and onClick, so adding alternateRowBackground there would mirror onClick exactly (a table-only field on the shared SQL schema, carried table-guarded through the external round-trip). The counterargument is keeping the MCP SQL tile schema lean. I'm happy to add it here if you want full parity across the MCP surface; left it out to keep the tool schema tight. Your call.

Test plan

  • mcp/__tests__/dashboards/saveDashboard.int.test.ts: 59/59 pass; the multi-tile create round-trip asserts alternateRowBackground: true survives on the returned builder table tile.
  • tsc --noEmit and eslint clean.

Incremental scope vs the base branch is 2 files / 9 production lines (Tier 2).

…oring schema

Adds alternateRowBackground to the clickstack_save_dashboard builder table tile schema and a short prompt guidance line, with a handler round-trip test asserting the field persists. Depends on the external API PR it is stacked on, since the MCP save path validates and converts through the external dashboard schema.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: db4a026

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

@vercel

vercel Bot commented Jul 23, 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 Jul 23, 2026 3:56pm
hyperdx-storybook Ready Ready Preview, Comment Jul 23, 2026 3:56pm

Request Review

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds zebra-striping support to MCP-authored builder table tiles.

  • Extends the builder table tile input schema with the optional alternateRowBackground setting.
  • Adds dashboard-authoring prompt guidance for using alternating row backgrounds on wide tables.
  • Extends the dashboard save integration test to verify the setting survives a builder-table round trip.
  • Adds a patch changeset for @hyperdx/api.

Confidence Score: 3/5

The prompt/schema mismatch should be fixed before merging because raw SQL table requests can silently lose the newly recommended setting.

Builder table round-tripping is covered and correctly wired, but the general prompt guidance reaches raw SQL table authoring while mcpSqlTileSchema strips the supported setting before persistence.

packages/api/src/mcp/prompts/dashboards/content.ts and packages/api/src/mcp/tools/dashboards/schemas.ts

Important Files Changed

Filename Overview
packages/api/src/mcp/tools/dashboards/schemas.ts Correctly exposes the setting for builder table tiles, but raw SQL MCP tables remain unable to submit the downstream-supported field.
packages/api/src/mcp/prompts/dashboards/content.ts Adds useful guidance, but its unqualified wording also directs raw SQL table authors toward a setting their MCP schema silently strips.
packages/api/src/mcp/tests/dashboards/saveDashboard.int.test.ts Verifies that an explicit true value survives the builder table save and response round trip.
.changeset/table-tile-alternate-row-mcp.md Documents the new builder table authoring capability as a patch release.

Fix All in Claude Code Fix All in Conductor Fix All in Cursor Fix All in Codex

Reviews (1): Last reviewed commit: "feat(mcp): expose table tile alternateRo..." | Re-trigger Greptile

3. GROUP BY HAS NO ALIAS HOOK. The chart config's groupBy is a single expression string and the renderer uses it verbatim as the column header (tables) and as the raw column name everywhere else (CSV export, tooltips, orderBy references, onClick template references). Grouping a table by SpanAttributes['http.route'] produces a column header that reads literally as arrayElement(SpanAttributes, 'http.route'). When a top-level column carries the same semantic, prefer it: SpanName for operation, ServiceName for service, SeverityText for log severity. When the dimension exists only as a Map attribute and the column header matters, drop to a raw SQL tile (configType: "sql") and write the column with AS alias. Line, stacked_bar, and pie tiles legend by the value not the column name, so the issue is invisible on the chart itself but still bites CSV export and onClick template references.

4. INVENTORY-STYLE TABLES PUT THE GROUP BY ON THE LEFT. Set groupByColumnsOnLeft: true on tables that read like a list of things (one row per service, per endpoint, per tenant).
4. INVENTORY-STYLE TABLES PUT THE GROUP BY ON THE LEFT. Set groupByColumnsOnLeft: true on tables that read like a list of things (one row per service, per endpoint, per tenant). For wide tables that are hard to scan, set alternateRowBackground: true to zebra-stripe the rows (default false).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Raw SQL setting is stripped

When an agent follows this unqualified guidance for a wide raw SQL table, mcpSqlTileSchema strips alternateRowBackground before the downstream schema receives it, causing the save to succeed without applying the requested zebra striping. Scope this guidance to builder tables or expose the field on the raw SQL MCP schema, which already has downstream support for it.

Knowledge Base Used: MCP server, AI assistant, and OpAMP integration

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. This is a small, additive change: one optional boolean on the MCP builder table tile schema, a prompt guidance sentence, and a round-trip assertion. The field name, type, and .describe() style mirror the sibling groupByColumnsOnLeft, and the builder-tile round-trip through the external dashboard schema (zod.tsconvertExternalTilesToInternal/convertToExternalDashboard) is verified end-to-end. The items below are recommendations, not blockers.

🟡 P2 -- recommended

  • packages/api/src/mcp/tools/dashboards/schemas.ts:825 -- mcpSqlTileSchema omits alternateRowBackground, so an agent cannot enable zebra striping on a raw-SQL table tile even though the app UI offers the toggle there and externalDashboardTableRawSqlChartConfigSchema accepts it; the new generic prompt line invites agents to set the field on any wide table, and Zod silently strips the unknown key on raw-SQL tiles, so the agent's intent is dropped without error.
    • Fix: Add alternateRowBackground to mcpSqlTileSchema.config for parity, or scope the prompt guidance in content.ts to builder table tiles so agents do not lose the key silently.
    • agent-native, api-contract, maintainability, kieran-typescript
🔵 P3 nitpicks (2)
  • packages/api/src/mcp/__tests__/dashboards/saveDashboard.int.test.ts:255 -- the new field is asserted only as true on the save response, with no persisted save→get→update→re-get round-trip through the MCP path and no explicit-false/omit case at this layer.

    • Fix: Add alternateRowBackground to the existing builder-tile round-trip test and cover an explicit-false case; note the external-layer omit/explicit-false round-trips are already pinned by the base commit.
  • .changeset/ -- a changeset covering this user-facing @hyperdx/api MCP schema addition could not be confirmed present, and AGENTS.md requires one for user-facing changes to published packages.

    • Fix: Confirm a changeset exists in .changeset/; add a patch changeset for @hyperdx/api if absent.

Reviewers (8): correctness, testing, maintainability, project-standards, kieran-typescript, api-contract, agent-native, learnings-researcher.

Testing gaps: MCP-path persistence of alternateRowBackground (save then re-fetch) is proven only transitively via the strict-passthrough contract plus base-commit external-layer coverage, not by a direct MCP round-trip assertion; the raw-SQL table tile path for the field is untested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant