diff --git a/.changeset/mcp-table-group-by-on-left.md b/.changeset/mcp-table-group-by-on-left.md new file mode 100644 index 0000000000..e23073adaa --- /dev/null +++ b/.changeset/mcp-table-group-by-on-left.md @@ -0,0 +1,5 @@ +--- +'@hyperdx/api': patch +--- + +Add groupByColumnsOnLeft to MCP dashboard table tile schema diff --git a/packages/api/src/mcp/__tests__/dashboards.test.ts b/packages/api/src/mcp/__tests__/dashboards.test.ts index 99d7bde30b..f2a8eaf1be 100644 --- a/packages/api/src/mcp/__tests__/dashboards.test.ts +++ b/packages/api/src/mcp/__tests__/dashboards.test.ts @@ -351,6 +351,8 @@ describe('MCP Dashboard Tools', () => { displayType: 'table', sourceId, select: [{ aggFn: 'count' }], + groupBy: 'SpanName', + groupByColumnsOnLeft: true, }, }, { @@ -392,6 +394,12 @@ describe('MCP Dashboard Tools', () => { expect(result.isError).toBeFalsy(); const output = JSON.parse(getFirstText(result)); expect(output.tiles).toHaveLength(5); + + const tableTile = output.tiles.find( + (t: { name: string }) => t.name === 'Table', + ); + expect(tableTile).toBeDefined(); + expect(tableTile.config.groupByColumnsOnLeft).toBe(true); }); it('should create a dashboard with a raw SQL tile', async () => { diff --git a/packages/api/src/mcp/tools/dashboards/schemas.ts b/packages/api/src/mcp/tools/dashboards/schemas.ts index b01f8c9454..b3aaffe044 100644 --- a/packages/api/src/mcp/tools/dashboards/schemas.ts +++ b/packages/api/src/mcp/tools/dashboards/schemas.ts @@ -146,6 +146,13 @@ const mcpTableTileSchema = mcpTileLayoutSchema.extend({ ), orderBy: z.string().optional().describe('Sort results by this column'), asRatio: z.boolean().optional(), + groupByColumnsOnLeft: z + .boolean() + .optional() + .describe( + 'Render Group By columns on the left side of the table, before the series columns. ' + + 'Default false (Group By columns on the right).', + ), }), });