You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
datasetId: z.string().describe('The unique dataset ID obtained from search_datasets or provided by the user'),
226
226
query: z.string().optional().describe('French keywords for full-text search across all dataset columns (simple keywords, not sentences). Do not use with filters parameter. Examples: "Jean Dupont", "Paris", "2025"'),
.describe('Precise filters on specific columns. Ideal for multi-condition queries or range searches. Each filter key must be: column_key + suffix. Available suffixes: _eq (strictly equal, case-sensitive), _search (full-text search within that column, case-insensitive and flexible matching), _gte (greater than or equal), _lte (less than or equal). Use column keys from describe_dataset. Example: { "nom_search": "Jean", "age_lte": "30", "ville_eq": "Paris"} searches for people whose names contain "Jean", who are 30 years old or younger, and who live in Paris.'),
234
+
.describe('Precise filters on specific columns. Ideal for multi-condition queries or range searches. Each filter key must be: column_key + suffix. Available suffixes: _eq (strictly equal, case-sensitive), _in (value must be in the list, case-sensitive, values separated by a comma), _search (full-text search within that column, case-insensitive and flexible matching), _gte (greater than or equal), _gt (greater than), _lte (less than or equal), _lt (less than). Use column keys from describe_dataset. Example: { "nom_search": "Jean", "age_lte": "30", "ville_eq": "Paris", "code_in": "A,B,C" } searches for people whose names contain "Jean", who are 30 years old or younger, who live in Paris, and whose code is A, B, or C.'),
235
235
select: z.string().optional().describe('Optional comma-separated list of column keys to include in the results. Useful when the dataset has many columns to reduce output size. If not provided, all columns are returned. Use column keys from describe_dataset. Format: column1,column2,column3 (No spaces after commas). Example: "nom,age,ville"')
* This tool allows users to perform aggregations on dataset columns, such as counting unique values,
303
+
* summing numeric columns, or calculating averages. It is useful for summarizing dataset content
304
+
* and extracting insights without retrieving all data rows.
305
+
* @param {string} datasetId - The unique ID of the dataset to aggregate (obtained from search_datasets)
306
+
* @param {string} aggregationColumn - The column key to aggregate (use keys from describe_dataset)
307
+
* @param {Object} aggregation - The aggregation specification to perform on the specified column.
308
+
* If not provided, defaults to counting unique values in the specified column.
309
+
* Example: { "column": "age", "metric": "avg" }
310
+
* This will return the average age grouped by the specified aggregationColumn.
311
+
* Supported metrics: sum, avg, min, max.
312
+
* If you want to sum a numeric column, use { "column": "column_key", "metric": "sum" }.
313
+
*/
314
+
server.registerTool(
315
+
'aggregate_data',
316
+
{
317
+
title: 'Aggregate data from a dataset',
318
+
description: 'Perform aggregations on dataset columns, such as counting unique values, summing numeric columns, or calculating averages. Use this after describe_dataset to understand the dataset structure and available column keys. Example: {"datasetId": "123", "aggregationColumn": "code_sexe", "operation": {"column": "age", "operation": "avg"}} this will return the average age grouped by code_sexe',
319
+
inputSchema: {
320
+
datasetId: z.string().describe('The unique dataset ID obtained from search_datasets tool'),
321
+
aggregationColumn: z.string().describe('The column key to aggregate (use keys from describe_dataset)'),
322
+
aggregation: z.object({
323
+
column: z.string().describe('The column key to aggregate (use keys from describe_dataset)'),
324
+
metric: z.enum(['sum','avg','min','max']).describe('Aggregation metric to perform on the column')
325
+
})
326
+
.optional()
327
+
.describe('The aggregation specification to perform on the specified column. Use keys from describe_dataset. If not provided, defaults to counting unique values in the specified column.')
328
+
},
329
+
outputSchema: {
330
+
total: z.number().describe('The total number of rows in the dataset'),
331
+
totalAggregated: z.number().describe('The total number of different values aggregated across all specified columns'),
332
+
datasetId: z.string().describe('The dataset ID that was aggregated'),
333
+
filteredViewUrl: z.string().describe('Direct URL to view the filtered dataset results in JSON format (must be included in responses for citation and direct access to aggregated view)'),
334
+
aggregations: z.array(
335
+
z.object({
336
+
total: z.number().describe('Total number of rows aggregated for this column'),
337
+
columnValue: z.string().describe('The value of the aggregated column'),
338
+
metricValue: z.number().optional().describe('The value of the aggregation metric (e.g., sum, avg) on the selected column'),
339
+
})
340
+
).describe('Array of aggregation results for each specified column')
0 commit comments