@lightdash/common 3.116.0 → 3.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/ee/AiAgent/composerSemanticArtifact.d.ts +4 -1
  3. package/dist/cjs/ee/AiAgent/composerSemanticArtifact.d.ts.map +1 -1
  4. package/dist/cjs/ee/AiAgent/composerSemanticArtifact.js +87 -5
  5. package/dist/cjs/ee/AiAgent/composerSemanticArtifact.js.map +1 -1
  6. package/dist/cjs/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts +117 -5
  7. package/dist/cjs/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts.map +1 -1
  8. package/dist/cjs/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js +89 -13
  9. package/dist/cjs/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js.map +1 -1
  10. package/dist/cjs/schemas/chartAsCodeSchema.d.ts +35 -35
  11. package/dist/cjs/schemas/json/mcp-tools-1.0.json +146 -6
  12. package/dist/esm/.tsbuildinfo +1 -1
  13. package/dist/esm/ee/AiAgent/composerSemanticArtifact.d.ts +4 -1
  14. package/dist/esm/ee/AiAgent/composerSemanticArtifact.d.ts.map +1 -1
  15. package/dist/esm/ee/AiAgent/composerSemanticArtifact.js +88 -6
  16. package/dist/esm/ee/AiAgent/composerSemanticArtifact.js.map +1 -1
  17. package/dist/esm/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts +117 -5
  18. package/dist/esm/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts.map +1 -1
  19. package/dist/esm/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js +90 -14
  20. package/dist/esm/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js.map +1 -1
  21. package/dist/esm/schemas/chartAsCodeSchema.d.ts +35 -35
  22. package/dist/esm/schemas/json/mcp-tools-1.0.json +146 -6
  23. package/dist/types/.tsbuildinfo +1 -1
  24. package/dist/types/ee/AiAgent/composerSemanticArtifact.d.ts +4 -1
  25. package/dist/types/ee/AiAgent/composerSemanticArtifact.d.ts.map +1 -1
  26. package/dist/types/ee/AiAgent/composerSemanticArtifact.js +88 -6
  27. package/dist/types/ee/AiAgent/composerSemanticArtifact.js.map +1 -1
  28. package/dist/types/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts +117 -5
  29. package/dist/types/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts.map +1 -1
  30. package/dist/types/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js +90 -14
  31. package/dist/types/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js.map +1 -1
  32. package/dist/types/schemas/chartAsCodeSchema.d.ts +35 -35
  33. package/dist/types/schemas/json/mcp-tools-1.0.json +146 -6
  34. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { type Explore } from '../../types/explore';
1
2
  import { type SemanticLayerSourceQuery } from '../../types/querySources';
2
3
  import type { AiCustomChartTypeChartArtifactConfig, AiSemanticChartArtifactConfig } from './index';
3
4
  import { type ComposerStoredChartVizConfig } from './schemas';
@@ -13,12 +14,14 @@ export type AiComposerSemanticArtifactVersion = {
13
14
  * keeps the classic interactions. Null when the classic payload cannot carry
14
15
  * the node or its viz config.
15
16
  */
16
- export declare const toComposerSemanticArtifactVersion: ({ title, description, node, vizConfig, maxQueryLimit, }: {
17
+ export declare const toComposerSemanticArtifactVersion: ({ title, description, node, vizConfig, maxQueryLimit, explore, }: {
17
18
  title: string;
18
19
  description: string | null;
19
20
  node: SemanticLayerSourceQuery;
20
21
  vizConfig: ComposerStoredChartVizConfig;
21
22
  /** The classic artifact clamps its limit to this. */
22
23
  maxQueryLimit: number;
24
+ /** Types custom metric filters; null when the explore is unavailable. */
25
+ explore: Explore | null;
23
26
  }) => AiComposerSemanticArtifactVersion | null;
24
27
  //# sourceMappingURL=composerSemanticArtifact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"composerSemanticArtifact.d.ts","sourceRoot":"","sources":["../../../../src/ee/AiAgent/composerSemanticArtifact.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,KAAK,EACR,oCAAoC,EACpC,6BAA6B,EAChC,MAAM,SAAS,CAAC;AACjB,OAAO,EAGH,KAAK,4BAA4B,EAGpC,MAAM,WAAW,CAAC;AAEnB,wEAAwE;AACxE,MAAM,MAAM,iCAAiC,GAAG;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EACH,6BAA6B,GAC7B,oCAAoC,CAAC;CAC9C,CAAC;AAkIF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,4DAM3C;IACC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,wBAAwB,CAAC;IAC/B,SAAS,EAAE,4BAA4B,CAAC;IACxC,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;CACzB,KAAG,iCAAiC,GAAG,IAiDvC,CAAC"}
1
+ {"version":3,"file":"composerSemanticArtifact.d.ts","sourceRoot":"","sources":["../../../../src/ee/AiAgent/composerSemanticArtifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAcnD,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAKzE,OAAO,KAAK,EACR,oCAAoC,EACpC,6BAA6B,EAChC,MAAM,SAAS,CAAC;AACjB,OAAO,EAGH,KAAK,4BAA4B,EAGpC,MAAM,WAAW,CAAC;AAEnB,wEAAwE;AACxE,MAAM,MAAM,iCAAiC,GAAG;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EACH,6BAA6B,GAC7B,oCAAoC,CAAC;CAC9C,CAAC;AAkNF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,qEAO3C;IACC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,wBAAwB,CAAC;IAC/B,SAAS,EAAE,4BAA4B,CAAC;IACxC,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3B,KAAG,iCAAiC,GAAG,IAiEvC,CAAC"}
@@ -1,6 +1,10 @@
1
- import { DimensionType } from '../../types/field';
1
+ import { DimensionType, MetricType } from '../../types/field';
2
2
  import { FilterOperator, FilterType, isFilterRule, } from '../../types/filter';
3
+ import { isPeriodOverPeriodAdditionalMetric, } from '../../types/metricQuery';
3
4
  import assertUnreachable from '../../utils/assertUnreachable';
5
+ import { getDimensions } from '../../utils/fields';
6
+ import { getFilterTypeFromItemType } from '../../utils/filters';
7
+ import { getItemId } from '../../utils/item';
4
8
  import { toolRunQueryExpressionResolvedArgsSchema, } from './schemas';
5
9
  // Persisted rules require a fieldType, which parsing validates and then drops.
6
10
  const fieldTypeOf = (filterType) => {
@@ -108,9 +112,78 @@ const toRunQueryChartConfig = (vizConfig) => {
108
112
  secondaryYAxisLabel: labels?.y2 ?? null,
109
113
  };
110
114
  };
115
+ const runQueryAggregations = [
116
+ MetricType.AVERAGE,
117
+ MetricType.COUNT,
118
+ MetricType.COUNT_DISTINCT,
119
+ MetricType.MAX,
120
+ MetricType.MIN,
121
+ MetricType.SUM,
122
+ MetricType.MEDIAN,
123
+ ];
124
+ /** A metric filter as runQuery persists it; undefined when its field is unknown. */
125
+ const toRunQueryMetricFilter = (rule, explore) => {
126
+ const dimension = getDimensions(explore).find((field) => `${field.table}.${field.name}` === rule.target.fieldRef);
127
+ if (!dimension)
128
+ return undefined;
129
+ const fieldFilterType = getFilterTypeFromItemType(dimension.type);
130
+ const settings = rule.settings;
131
+ const hasValues = rule.operator !== FilterOperator.NULL &&
132
+ rule.operator !== FilterOperator.NOT_NULL;
133
+ return {
134
+ table: dimension.table,
135
+ filter: {
136
+ fieldId: getItemId(dimension),
137
+ fieldType: dimension.type,
138
+ fieldFilterType,
139
+ operator: rule.operator,
140
+ ...(hasValues ? { values: rule.values ?? [] } : {}),
141
+ ...(settings !== undefined ? { settings } : {}),
142
+ },
143
+ };
144
+ };
145
+ /** runQuery's custom metrics for a node's additional metrics; undefined when one cannot be carried. */
146
+ const toRunQueryCustomMetrics = (additionalMetrics, explore) => {
147
+ const customMetrics = additionalMetrics.map((metric) => {
148
+ if (isPeriodOverPeriodAdditionalMetric(metric)) {
149
+ // runQuery's comparison builder drops distinct keys and percentiles.
150
+ if (metric.distinctKeys?.length || metric.percentile !== undefined)
151
+ return undefined;
152
+ return {
153
+ kind: 'periodComparison',
154
+ baseMetricId: metric.baseMetricId,
155
+ timeDimensionId: metric.timeDimensionId,
156
+ granularity: metric.granularity,
157
+ periodOffset: metric.periodOffset,
158
+ };
159
+ }
160
+ if (!metric.baseDimensionName ||
161
+ !runQueryAggregations.includes(metric.type)) {
162
+ return undefined;
163
+ }
164
+ const filters = (metric.filters ?? []).map((rule) => explore ? toRunQueryMetricFilter(rule, explore) : undefined);
165
+ if (filters.some((filter) => filter === undefined))
166
+ return undefined;
167
+ return {
168
+ kind: 'aggregation',
169
+ name: metric.name,
170
+ label: metric.label ?? metric.name,
171
+ description: metric.description ?? '',
172
+ baseDimensionName: getItemId({
173
+ table: metric.table,
174
+ name: metric.baseDimensionName,
175
+ }),
176
+ table: metric.table,
177
+ type: metric.type,
178
+ filters: filters.length > 0 ? filters : null,
179
+ };
180
+ });
181
+ return customMetrics.every((metric) => metric !== undefined)
182
+ ? customMetrics
183
+ : undefined;
184
+ };
111
185
  // Fields the runQuery payload has no place for.
112
186
  const hasClassicQueryShape = (node) => !node.tableCalculations?.length &&
113
- !node.additionalMetrics?.length &&
114
187
  !node.customDimensions?.length &&
115
188
  !node.metricOverrides &&
116
189
  !node.dimensionOverrides &&
@@ -121,27 +194,36 @@ const hasClassicQueryShape = (node) => !node.tableCalculations?.length &&
121
194
  * keeps the classic interactions. Null when the classic payload cannot carry
122
195
  * the node or its viz config.
123
196
  */
124
- export const toComposerSemanticArtifactVersion = ({ title, description, node, vizConfig, maxQueryLimit, }) => {
197
+ export const toComposerSemanticArtifactVersion = ({ title, description, node, vizConfig, maxQueryLimit, explore, }) => {
125
198
  if (!hasClassicQueryShape(node))
126
199
  return null;
127
200
  if (node.limit !== undefined && node.limit > maxQueryLimit)
128
201
  return null;
129
202
  const filters = toResolvedFilters(node.filters);
130
203
  const chartConfig = toRunQueryChartConfig(vizConfig);
131
- if (filters === undefined || chartConfig === undefined)
204
+ const additionalMetrics = node.additionalMetrics ?? [];
205
+ const customMetrics = toRunQueryCustomMetrics(additionalMetrics, explore);
206
+ if (filters === undefined ||
207
+ chartConfig === undefined ||
208
+ customMetrics === undefined) {
132
209
  return null;
210
+ }
211
+ // runQuery derives period comparison columns from customMetrics itself.
212
+ const generatedMetricIds = new Set(additionalMetrics
213
+ .filter(isPeriodOverPeriodAdditionalMetric)
214
+ .map(getItemId));
133
215
  const parsed = toolRunQueryExpressionResolvedArgsSchema.safeParse({
134
216
  title,
135
217
  description: description ?? '',
136
218
  queryConfig: {
137
219
  exploreName: node.exploreName,
138
220
  dimensions: node.dimensions,
139
- metrics: node.metrics,
221
+ metrics: node.metrics.filter((metricId) => !generatedMetricIds.has(metricId)),
140
222
  filters,
141
223
  sorts: node.sorts ?? [],
142
224
  limit: node.limit ?? null,
143
225
  parameters: node.parameters ?? null,
144
- customMetrics: null,
226
+ customMetrics: customMetrics.length > 0 ? customMetrics : null,
145
227
  tableCalculations: null,
146
228
  },
147
229
  chartConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"composerSemanticArtifact.js","sourceRoot":"","sources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,GAAG;QACZ,YAAY,EAAE,OAAgB;QAC9B,KAAK;QACL,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;IACF,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO;YACH,GAAG,OAAO;YACV,SAAS,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;SACzD,CAAC;IACN,CAAC;IACD,OAAO;QACH,GAAG,OAAO;QACV,SAAS,EAAE;YACP,MAAM,EAAE,iBAAiB;YACzB,aAAa,EAAE,CAAC;YAChB,cAAc,EAAE,SAAS,CAAC,cAAc;YACxC,GAAG,CAAC,SAAS,CAAC,iBAAiB,KAAK,IAAI;gBACpC,CAAC,CAAC,EAAE,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,EAAE;gBACpD,CAAC,CAAC,EAAE,CAAC;YACT,MAAM,EAAE,MAAM,CAAC,IAAI;SACtB;KACJ,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"composerSemanticArtifact.js","sourceRoot":"","sources":["../../../../src/ee/AiAgent/composerSemanticArtifact.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACH,cAAc,EACd,UAAU,EACV,YAAY,GAIf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,kCAAkC,GAErC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C,OAAO,EACH,wCAAwC,GAK3C,MAAM,WAAW,CAAC;AAYnB,+EA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AAC,EAAE,CAAC;YACT,MAAM,EAAE,MAAM,CAAC,IAAI;SACtB;KACJ,CAAC;AACN,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { DimensionType } from '../../../../types/field';
2
+ import { DimensionType, MetricType } from '../../../../types/field';
3
3
  import { type Filters } from '../../../../types/filter';
4
+ import { type AdditionalMetric } from '../../../../types/metricQuery';
4
5
  import { QuerySourceType, type ApiConnectorType, type ApiSourceQuery, type DuckdbSourceQuery, type ExternalSourceQuery, type PythonSourceQuery, type QueryNodeId, type SemanticLayerSourceQuery, type SqlSourceQuery } from '../../../../types/querySources';
5
6
  /** The composer query tool's name, and the name calls persisted before the rename carry. */
6
7
  export declare const COMPOSER_QUERY_TOOL_NAMES: readonly ['query', 'runComposerQueries'];
@@ -9,6 +10,7 @@ export declare const isComposerQueryToolName: (toolName: string) => toolName is
9
10
  export declare const DEFAULT_COMPOSER_QUERY_LIMIT = 500;
10
11
  export declare const DEFAULT_COMPOSER_QUERY_MAX_LIMIT = 5000;
11
12
  export declare const COMPOSER_QUERY_PREVIEW_ROW_LIMIT = 50;
13
+ export declare const COMPOSER_NODE_SAMPLE_ROW_LIMIT = 5;
12
14
  /** A project connection an api node can query. */
13
15
  export type ComposerApiConnection = {
14
16
  connectionUuid: string;
@@ -26,6 +28,32 @@ export declare const composerSemanticLayerFiltersSchema: z.ZodNullable<z.ZodObje
26
28
  dimensions: z.ZodNullable<z.ZodString>;
27
29
  metrics: z.ZodNullable<z.ZodString>;
28
30
  }, z.core.$strict>>;
31
+ declare const composerCustomMetricSchema: z.ZodObject<{
32
+ table: z.ZodString;
33
+ name: z.ZodString;
34
+ label: z.ZodString;
35
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ aggregation: z.ZodEnum<{
37
+ average: MetricType.AVERAGE;
38
+ count: MetricType.COUNT;
39
+ count_distinct: MetricType.COUNT_DISTINCT;
40
+ max: MetricType.MAX;
41
+ median: MetricType.MEDIAN;
42
+ min: MetricType.MIN;
43
+ percentile: MetricType.PERCENTILE;
44
+ sum: MetricType.SUM;
45
+ }>;
46
+ dimensionFieldId: z.ZodString;
47
+ percentile: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
48
+ filter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ }, z.core.$strip>;
50
+ declare const composerPeriodComparisonSchema: z.ZodObject<{
51
+ metricFieldId: z.ZodString;
52
+ timeDimensionFieldId: z.ZodString;
53
+ periodOffset: z.ZodCoercedNumber<unknown>;
54
+ }, z.core.$strip>;
55
+ export type ToolComposerCustomMetric = z.infer<typeof composerCustomMetricSchema>;
56
+ export type ToolComposerPeriodComparison = z.infer<typeof composerPeriodComparisonSchema>;
29
57
  type CreateToolComposerQueriesArgsSchemaOptions = {
30
58
  maxLimit?: number;
31
59
  defaultLimit?: number;
@@ -55,7 +83,31 @@ export declare const createToolComposerQueriesArgsSchemaV1: ({ maxLimit, default
55
83
  fieldId: z.ZodString;
56
84
  descending: z.ZodBoolean;
57
85
  }, z.core.$strip>>>;
58
- parameters: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
86
+ customMetrics: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
87
+ table: z.ZodString;
88
+ name: z.ZodString;
89
+ label: z.ZodString;
90
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
+ aggregation: z.ZodEnum<{
92
+ average: MetricType.AVERAGE;
93
+ count: MetricType.COUNT;
94
+ count_distinct: MetricType.COUNT_DISTINCT;
95
+ max: MetricType.MAX;
96
+ median: MetricType.MEDIAN;
97
+ min: MetricType.MIN;
98
+ percentile: MetricType.PERCENTILE;
99
+ sum: MetricType.SUM;
100
+ }>;
101
+ dimensionFieldId: z.ZodString;
102
+ percentile: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
103
+ filter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
+ }, z.core.$strip>>>>;
105
+ periodComparisons: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
106
+ metricFieldId: z.ZodString;
107
+ timeDimensionFieldId: z.ZodString;
108
+ periodOffset: z.ZodCoercedNumber<unknown>;
109
+ }, z.core.$strip>>>>;
110
+ parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
59
111
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
60
112
  }, z.core.$strip>, z.ZodObject<{
61
113
  title: z.ZodString;
@@ -122,7 +174,31 @@ export declare const toolComposerQueriesArgsSchema: z.ZodObject<{
122
174
  fieldId: z.ZodString;
123
175
  descending: z.ZodBoolean;
124
176
  }, z.core.$strip>>>;
125
- parameters: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
177
+ customMetrics: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
178
+ table: z.ZodString;
179
+ name: z.ZodString;
180
+ label: z.ZodString;
181
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
182
+ aggregation: z.ZodEnum<{
183
+ average: MetricType.AVERAGE;
184
+ count: MetricType.COUNT;
185
+ count_distinct: MetricType.COUNT_DISTINCT;
186
+ max: MetricType.MAX;
187
+ median: MetricType.MEDIAN;
188
+ min: MetricType.MIN;
189
+ percentile: MetricType.PERCENTILE;
190
+ sum: MetricType.SUM;
191
+ }>;
192
+ dimensionFieldId: z.ZodString;
193
+ percentile: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
194
+ filter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
+ }, z.core.$strip>>>>;
196
+ periodComparisons: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
197
+ metricFieldId: z.ZodString;
198
+ timeDimensionFieldId: z.ZodString;
199
+ periodOffset: z.ZodCoercedNumber<unknown>;
200
+ }, z.core.$strip>>>>;
201
+ parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
126
202
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
127
203
  }, z.core.$strip>, z.ZodObject<{
128
204
  title: z.ZodString;
@@ -188,7 +264,31 @@ export declare const toolComposerQueriesArgsSchemaPersisted: z.ZodPreprocess<z.Z
188
264
  fieldId: z.ZodString;
189
265
  descending: z.ZodBoolean;
190
266
  }, z.core.$strip>>>;
191
- parameters: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
267
+ customMetrics: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
268
+ table: z.ZodString;
269
+ name: z.ZodString;
270
+ label: z.ZodString;
271
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
272
+ aggregation: z.ZodEnum<{
273
+ average: MetricType.AVERAGE;
274
+ count: MetricType.COUNT;
275
+ count_distinct: MetricType.COUNT_DISTINCT;
276
+ max: MetricType.MAX;
277
+ median: MetricType.MEDIAN;
278
+ min: MetricType.MIN;
279
+ percentile: MetricType.PERCENTILE;
280
+ sum: MetricType.SUM;
281
+ }>;
282
+ dimensionFieldId: z.ZodString;
283
+ percentile: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
284
+ filter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
+ }, z.core.$strip>>>>;
286
+ periodComparisons: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
287
+ metricFieldId: z.ZodString;
288
+ timeDimensionFieldId: z.ZodString;
289
+ periodOffset: z.ZodCoercedNumber<unknown>;
290
+ }, z.core.$strip>>>>;
291
+ parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
192
292
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
193
293
  }, z.core.$strip>, z.ZodObject<{
194
294
  title: z.ZodString;
@@ -239,8 +339,9 @@ export type ToolComposerQueryNode = z.infer<ReturnType<typeof createToolComposer
239
339
  export type ToolComposerSemanticLayerNode = Extract<ToolComposerQueryNode, {
240
340
  sourceType: QuerySourceType.SEMANTIC_LAYER;
241
341
  }>;
242
- export type ResolvedToolComposerQueryNode = Exclude<ToolComposerQueryNode, ToolComposerSemanticLayerNode> | (Omit<ToolComposerSemanticLayerNode, 'filters'> & {
342
+ export type ResolvedToolComposerQueryNode = Exclude<ToolComposerQueryNode, ToolComposerSemanticLayerNode> | (Omit<ToolComposerSemanticLayerNode, 'filters' | 'customMetrics' | 'periodComparisons'> & {
243
343
  filters: Filters | null;
344
+ additionalMetrics: AdditionalMetric[];
244
345
  });
245
346
  /**
246
347
  * Converts a validated tool node into the canonical SourceQuery shape the
@@ -270,6 +371,11 @@ export declare const toolComposerQueriesStructuredContentSchema: z.ZodObject<{
270
371
  sourceType: z.ZodEnum<typeof QuerySourceType>;
271
372
  rowCount: z.ZodNullable<z.ZodNumber>;
272
373
  limit: z.ZodNumber;
374
+ columns: z.ZodNullable<z.ZodArray<z.ZodObject<{
375
+ reference: z.ZodString;
376
+ type: z.ZodEnum<typeof DimensionType>;
377
+ }, z.core.$strip>>>;
378
+ sample: z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
273
379
  }, z.core.$strip>>;
274
380
  columns: z.ZodArray<z.ZodObject<{
275
381
  reference: z.ZodString;
@@ -312,6 +418,7 @@ export declare const mcpQueryStructuredOutputSchema: z.ZodObject<{
312
418
  reference: z.ZodString;
313
419
  type: z.ZodEnum<typeof DimensionType>;
314
420
  }, z.core.$strip>>>;
421
+ sample: z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
315
422
  }, z.core.$strip>>;
316
423
  }, z.core.$strip>;
317
424
  export type McpQueryStructuredContent = z.infer<typeof mcpQueryStructuredOutputSchema>;
@@ -352,6 +459,11 @@ export declare const toolComposerQueriesOutputSchema: z.ZodUnion<readonly [z.Zod
352
459
  sourceType: z.ZodEnum<typeof QuerySourceType>;
353
460
  rowCount: z.ZodNullable<z.ZodNumber>;
354
461
  limit: z.ZodNumber;
462
+ columns: z.ZodNullable<z.ZodArray<z.ZodObject<{
463
+ reference: z.ZodString;
464
+ type: z.ZodEnum<typeof DimensionType>;
465
+ }, z.core.$strip>>>;
466
+ sample: z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
355
467
  }, z.core.$strip>>;
356
468
  columns: z.ZodArray<z.ZodObject<{
357
469
  reference: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"toolComposerQueryArgs.d.ts","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolComposerQueryArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAMxD,OAAO,EACH,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACtB,MAAM,gCAAgC,CAAC;AAUxC,4FAA4F;AAC5F,eAAO,MAAM,yBAAyB,YAClC,OAAO,EACP,oBAAoB,CACd,CAAC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;;iBAM5C,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,wCAAwC,CAClD,CAAC;AAEF,eAAO,MAAM,uCAAuC,aACtC,OAAO,KAClB,kCAAkC,GAAG,IAGvC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAS1C,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CACzC,UAAU,CAAC,OAAO,mCAAmC,CAAC,CACzD,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,+BAA+B,CACzC,CAAC;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,0CAA0C,CACpD,CAAC"}
1
+ {"version":3,"file":"toolComposerQueryArgs.d.ts","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolComposerQueryArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACH,KAAK,gBAAgB,EAGxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACH,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACtB,MAAM,gCAAgC,CAAC;AAaxC,4FAA4F;AAC5F,eAAO,MAAM,yBAAyB,YAClC,OAAO,EACP,oBAAoB,CACd,CAAC;AAEX,MA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IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC;AAE5B,eAAO,MAAM,kCAAkC,SACrC,6BAA6B,KACpC,oBAyEF,CAAC;AAsBF;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC,UACrC,OAAO,KACf,uBAAuB,GAAG,IAiH5B,CAAC;AAsCF,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCrD,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CzC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,8BAA8B,CACxC,CAAC;AAEF,QAAA,MAAM,wCAAwC;;;;;;iBAM5C,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,wCAAwC,CAClD,CAAC;AAEF,eAAO,MAAM,uCAAuC,aACtC,OAAO,KAClB,kCAAkC,GAAG,IAGvC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAS1C,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CACzC,UAAU,CAAC,OAAO,mCAAmC,CAAC,CACzD,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,+BAA+B,CACzC,CAAC;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,0CAA0C,CACpD,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { DimensionType } from '../../../../types/field';
2
+ import { DimensionType, MetricType } from '../../../../types/field';
3
3
  import { QuerySourceType, } from '../../../../types/querySources';
4
4
  import assertUnreachable from '../../../../utils/assertUnreachable';
5
- import { filterExpressionsSchema } from '../filterExpressions/expressionSchemas';
5
+ import { filterExpressionInputSchema, filterExpressionsSchema, } from '../filterExpressions/expressionSchemas';
6
6
  import { structuredToolOutputSchema } from '../outputMetadata';
7
7
  import { createToolSchema } from '../toolSchemaBuilder';
8
8
  import { appliedParametersSchema, parameterValueSchema, } from './toolRunQueryArgs';
@@ -15,6 +15,7 @@ export const isComposerQueryToolName = (toolName) => COMPOSER_QUERY_TOOL_NAMES.i
15
15
  export const DEFAULT_COMPOSER_QUERY_LIMIT = 500;
16
16
  export const DEFAULT_COMPOSER_QUERY_MAX_LIMIT = 5000;
17
17
  export const COMPOSER_QUERY_PREVIEW_ROW_LIMIT = 50;
18
+ export const COMPOSER_NODE_SAMPLE_ROW_LIMIT = 5;
18
19
  const getComposerNodeKindsDescription = ({ enablePythonNodes, apiConnections, sqlNote, }) => `Node kinds:
19
20
  - "semanticLayer": a metric query against an explore. Result columns are the requested field ids.
20
21
  - "sql": raw SQL against the project warehouse; ${sqlNote}.
@@ -30,7 +31,7 @@ const getComposerNodeKindsDescription = ({ enablePythonNodes, apiConnections, sq
30
31
  : ''}
31
32
 
32
33
  A node reads only the rows its references returned, so a referenced result that reached its limit is incomplete: before totalling, averaging or ranking over it, give that node a limit that holds its whole population, or aggregate there.`;
33
- export const getToolComposerQueriesDescription = ({ enablePythonNodes, apiConnections, }) => `Run a pipeline: one or more nodes submitted together, where ${enablePythonNodes ? 'duckdb and python' : 'duckdb'} nodes join or transform other nodes' results. The terminal node's rows are returned to you.
34
+ export const getToolComposerQueriesDescription = ({ enablePythonNodes, apiConnections, }) => `Run a pipeline: one or more nodes submitted together, where ${enablePythonNodes ? 'duckdb and python' : 'duckdb'} nodes join or transform other nodes' results. One call returns one node's rows, the terminal node's, so exactly one submitted node may go unread by the others: to get several results, combine them in one duckdb node (UNION ALL or JOIN) or submit them in separate calls. Every other submitted node is listed with its columns and first rows.
34
35
 
35
36
  ${getComposerNodeKindsDescription({
36
37
  enablePythonNodes,
@@ -39,7 +40,9 @@ ${getComposerNodeKindsDescription({
39
40
  })}
40
41
 
41
42
  Reuse across calls: a node id names one node for the whole thread. To build on a node from an earlier call, read its node id in "references" without resubmitting it; it is copied into this pipeline with everything it reads and served from cache when possible. Resubmitting a node id with a different definition is an error, so give a changed node a new node id.`;
42
- export const MCP_TOOL_QUERY_DESCRIPTION = `Run a pipeline: one or more nodes submitted together, where duckdb and python nodes join or transform other nodes' results. A pipeline of one node runs a single semantic-layer or SQL query, and later calls can reuse its node.
43
+ export const MCP_TOOL_QUERY_DESCRIPTION = `Run a pipeline: one or more nodes submitted together, where duckdb and python nodes join or transform other nodes' results. A pipeline of one node runs a single semantic-layer or SQL query.
44
+
45
+ One call returns one node's rows, so exactly one submitted node may go unread by the others: combine several results in one duckdb node (UNION ALL or JOIN), or submit them in separate calls reusing earlier nodes.
43
46
 
44
47
  ${getComposerNodeKindsDescription({
45
48
  enablePythonNodes: true,
@@ -49,9 +52,9 @@ ${getComposerNodeKindsDescription({
49
52
 
50
53
  A python node's "code" defines \`def run(inputs, params)\`, and semanticLayer "filters" are flat expression strings; each field documents its contract.
51
54
 
52
- Reuse earlier nodes: a result returns a sessionId once a node has finished; finished nodes are saved in it. On a follow-up, pass that sessionId and read saved nodes by node id in "references", submitting only the new nodes. Reused nodes come with everything they read and are served from cache when possible, so results come back faster. A saved node id names one node for the whole session, so give a changed node a new node id; a failed or unfinished node is not saved, so resubmit it under the same id. Omit sessionId to start a new session.
55
+ Reuse earlier nodes: a result returns a sessionId once a node has finished; finished nodes are saved in it. On a follow-up, pass that sessionId and read saved nodes by node id in "references", submitting only the new nodes. Reused nodes bring everything they read and are served from cache when possible. A saved node id names one node for the whole session, so give a changed node a new node id; a failed or unfinished node is not saved, so resubmit it under the same id. Omit sessionId to start a new session.
53
56
 
54
- Returns a preview of the terminal node's rows and every node's queryUuid. The terminal node is the unique sink, or the node named in terminalNodeId. If the result is running, follow up with get_query_result on the terminal node's queryUuid; it also fetches the first page of any node's result by its queryUuid. query computes data only; it saves and charts nothing.`;
57
+ Returns the terminal node's first rows, other submitted nodes' columns and first rows, and every node's queryUuid. If the result is running, follow up with get_query_result on the terminal node's queryUuid; it also fetches the first page of any node's result by its queryUuid. query computes data only; it saves and charts nothing.`;
55
58
  export const TOOL_COMPOSER_QUERIES_DESCRIPTION = getToolComposerQueriesDescription({
56
59
  enablePythonNodes: false,
57
60
  apiConnections: [],
@@ -75,6 +78,57 @@ export const composerSemanticLayerFiltersSchema = filterExpressionsSchema
75
78
  .strict()
76
79
  .nullable()
77
80
  .describe("Filters on this node's explore as flat expression strings, never structured rule objects: one for dimension fields and one for metric fields, each choosing AND or OR independently and combined with AND. Null when unfiltered, or null for an unused kind.");
81
+ const composerCustomMetricSchema = z.object({
82
+ table: z
83
+ .string()
84
+ .describe('Table of the base dimension; the metric belongs to it.'),
85
+ name: z
86
+ .string()
87
+ .regex(/^[a-z][a-z0-9_]*$/, 'Custom metric names use lowercase snake_case')
88
+ .describe('snake_case name. The metric\'s field id is "<table>_<name>": list it in "metrics" to select it, and use it in sorts, metric filters and periodComparisons.'),
89
+ label: z.string().describe('Column label shown to users.'),
90
+ description: z
91
+ .string()
92
+ .nullish()
93
+ .describe("Shown to users as the metric's description. Null when the label is enough."),
94
+ aggregation: z
95
+ .enum([
96
+ MetricType.SUM,
97
+ MetricType.AVERAGE,
98
+ MetricType.COUNT,
99
+ MetricType.COUNT_DISTINCT,
100
+ MetricType.MIN,
101
+ MetricType.MAX,
102
+ MetricType.MEDIAN,
103
+ MetricType.PERCENTILE,
104
+ ])
105
+ .describe('Aggregation over the base dimension. Number dimensions take any; string, date and timestamp dimensions take count, count_distinct, min or max; boolean dimensions take count or count_distinct.'),
106
+ dimensionFieldId: z
107
+ .string()
108
+ .describe('Field id of the dimension to aggregate, a dimension of "table".'),
109
+ percentile: z
110
+ .number()
111
+ .min(0)
112
+ .max(100)
113
+ .nullish()
114
+ .describe('0–100, set only for the percentile aggregation.'),
115
+ filter: filterExpressionInputSchema
116
+ .nullish()
117
+ .describe('Aggregates only the rows this flat AND expression over dimensions matches, in the node filter grammar, e.g. "orders_status equals=completed". Null aggregates every row.'),
118
+ });
119
+ const composerPeriodComparisonSchema = z.object({
120
+ metricFieldId: z
121
+ .string()
122
+ .describe('Metric to compare: a field id in "metrics", explore or custom.'),
123
+ timeDimensionFieldId: z
124
+ .string()
125
+ .describe('Time dimension in "dimensions" with a day, week, month, quarter or year grain; the offset counts in that grain.'),
126
+ periodOffset: z.coerce
127
+ .number()
128
+ .int()
129
+ .min(1)
130
+ .describe('Periods to look back: 1 for the previous period, 12 on a month grain for the same month last year.'),
131
+ });
78
132
  const sortFieldSchema = z.object({
79
133
  fieldId: z.string().describe('Field id to sort by.'),
80
134
  descending: z
@@ -120,10 +174,17 @@ export const createToolComposerQueriesArgsSchemaV1 = ({ maxLimit = DEFAULT_COMPO
120
174
  .array(sortFieldSchema)
121
175
  .nullable()
122
176
  .describe('Sorts by fields this node also selects in dimensions or metrics, e.g. [{"fieldId": "orders_order_date", "descending": true}].'),
177
+ customMetrics: z
178
+ .array(composerCustomMetricSchema)
179
+ .nullish()
180
+ .describe('Metrics the explore lacks, each an aggregation over one of its dimensions, computed in this query.'),
181
+ periodComparisons: z
182
+ .array(composerPeriodComparisonSchema)
183
+ .nullish()
184
+ .describe('Each adds a column holding a metric shifted back in time, next to that metric, e.g. revenue the same month last year. The warehouse reads the earlier period even when the filters exclude it. The column id is generated; read it from the result columns.'),
123
185
  parameters: z
124
186
  .record(z.string(), parameterValueSchema)
125
- .nullable()
126
- .default(null)
187
+ .nullish()
127
188
  .describe('Parameter values for this node, keyed by parameter name exactly as shown in the explore metadata (e.g. {"orders.metric": "active_users"}). Set them whenever a selected field is marked "requires parameters" and the default does not match what the user asked for: an unset parameter silently resolves to its default, which can return the wrong data. null when the explore has no parameters or the defaults are correct.'),
128
189
  limit: limitSchema,
129
190
  });
@@ -213,7 +274,7 @@ export const createToolComposerQueriesArgsSchemaV1 = ({ maxLimit = DEFAULT_COMPO
213
274
  terminalNodeId: z
214
275
  .string()
215
276
  .nullable()
216
- .describe('The terminal node. Null picks the unique sink, the one submitted node no other submitted node reads; name a node when there are several sinks.'),
277
+ .describe('The terminal node. Null picks the one submitted node no other submitted node reads; a node id returns that node of the pipeline instead, including a node from an earlier call.'),
217
278
  })
218
279
  .build();
219
280
  };
@@ -272,6 +333,9 @@ export const toolComposerQueryNodeToSourceQuery = (node) => {
272
333
  filters,
273
334
  sorts,
274
335
  parameters,
336
+ ...(node.additionalMetrics.length > 0
337
+ ? { additionalMetrics: node.additionalMetrics }
338
+ : {}),
275
339
  limit: node.limit,
276
340
  };
277
341
  }
@@ -453,6 +517,10 @@ export const parsePartialToolComposerQueriesArgs = (input) => {
453
517
  terminalNodeId: typeof raw.terminalNodeId === 'string' ? raw.terminalNodeId : null,
454
518
  };
455
519
  };
520
+ const composerQueryColumnSchema = z.object({
521
+ reference: z.string().describe('Column name as it appears in the rows.'),
522
+ type: z.nativeEnum(DimensionType),
523
+ });
456
524
  const composerQueryNodeSummarySchema = z.object({
457
525
  nodeId: nodeIdSchema,
458
526
  title: z.string().nullable().describe('What users see for this node.'),
@@ -468,10 +536,14 @@ const composerQueryNodeSummarySchema = z.object({
468
536
  .int()
469
537
  .positive()
470
538
  .describe('Row limit this node ran with. A rowCount equal to it means the node reached its limit, so more rows may exist.'),
471
- });
472
- const composerQueryColumnSchema = z.object({
473
- reference: z.string().describe('Column name as it appears in the rows.'),
474
- type: z.nativeEnum(DimensionType),
539
+ columns: z
540
+ .array(composerQueryColumnSchema)
541
+ .nullable()
542
+ .describe('Columns of a node submitted in this call; null for reused nodes and for the terminal node, whose columns are in columns.'),
543
+ sample: z
544
+ .array(z.record(z.string(), z.unknown()))
545
+ .nullable()
546
+ .describe(`First ${COMPOSER_NODE_SAMPLE_ROW_LIMIT} rows of a node submitted in this call other than the terminal node; null otherwise or when data access is disabled.`),
475
547
  });
476
548
  export const toolComposerQueriesStructuredContentSchema = z.object({
477
549
  terminalNodeId: nodeIdSchema.describe('Node whose rows are returned.'),
@@ -529,7 +601,11 @@ export const mcpQueryStructuredOutputSchema = z.object({
529
601
  columns: z
530
602
  .array(composerQueryColumnSchema)
531
603
  .nullable()
532
- .describe('Result columns; null until the node is done.'),
604
+ .describe('Result columns of the terminal node and of nodes submitted in this call; null for reused nodes and until the node is done.'),
605
+ sample: z
606
+ .array(z.record(z.string(), z.unknown()))
607
+ .nullable()
608
+ .describe(`First ${COMPOSER_NODE_SAMPLE_ROW_LIMIT} rows of a done node submitted in this call other than the terminal node; null for the terminal node and for reused, failed or unfinished nodes.`),
533
609
  }))
534
610
  .describe('Every node of the pipeline, in dependency order.'),
535
611
  });