Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(mcp-host): name the chart datasets a single-series type leaves out

marcoteb83843624c62a
diff --git a/mcp-host/src/workflow/__tests__/chartData.test.ts b/mcp-host/src/workflow/__tests__/chartData.test.ts
index 755bcc16b..3364791e8 100644
--- a/mcp-host/src/workflow/__tests__/chartData.test.ts
+++ b/mcp-host/src/workflow/__tests__/chartData.test.ts
@@ -253,7 +253,12 @@ describe('normalizeChartData — repairs', () => {
{ labels: ['a'], datasets: [{ data: [1] }, { data: [2] }] },
{ chartType: 'funnel' }
)
- expect(r.warnings.join(' ')).toContain('single series')
+ expect(r.warnings.join(' ')).toContain('`data.datasets[1]`: "funnel" draws a single series')
+ const gauge = normalizeChartData(
+ { datasets: [{ data: [40] }, { data: [50] }, { data: [60] }] },
+ { chartType: 'gauge' }
+ )
+ expect(gauge.warnings.join(' ')).toContain('`data.datasets[1..2]`')
})
it('carries explicit colors through untouched', () => {
diff --git a/mcp-host/src/workflow/chartData.ts b/mcp-host/src/workflow/chartData.ts
index c94de9b6d..737fd2268 100644
--- a/mcp-host/src/workflow/chartData.ts
+++ b/mcp-host/src/workflow/chartData.ts
@@ -574,8 +574,10 @@ export function normalizeChartData(raw: unknown, opts: NormalizeOptions): Normal
if (labelled.some(Boolean)) labels = placeByLabel(labels, datasets, labelled, root, warnings)
if (SINGLE_SERIES_TYPES.has(chartType) && datasets.length > 1) {
+ const extra = datasets.length - 1
warnings.push(
- `"${chartType}" draws a single series; ${datasets.length - 1} extra dataset(s) were dropped.`
+ `\`${root}.datasets[${extra === 1 ? '1' : `1..${extra}`}]\`: "${chartType}" draws a ` +
+ `single series; ${extra} extra dataset(s) were dropped.`
)
}