qorrelate-mcp-server 0.1.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.
- package/README.md +197 -0
- package/dist/client.d.ts +293 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +358 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +242 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/alerts.d.ts +14 -0
- package/dist/tools/alerts.d.ts.map +1 -0
- package/dist/tools/alerts.js +381 -0
- package/dist/tools/alerts.js.map +1 -0
- package/dist/tools/dashboards.d.ts +14 -0
- package/dist/tools/dashboards.d.ts.map +1 -0
- package/dist/tools/dashboards.js +409 -0
- package/dist/tools/dashboards.js.map +1 -0
- package/dist/tools/data-control.d.ts +19 -0
- package/dist/tools/data-control.d.ts.map +1 -0
- package/dist/tools/data-control.js +213 -0
- package/dist/tools/data-control.js.map +1 -0
- package/dist/tools/logs.d.ts +14 -0
- package/dist/tools/logs.d.ts.map +1 -0
- package/dist/tools/logs.js +191 -0
- package/dist/tools/logs.js.map +1 -0
- package/dist/tools/metrics.d.ts +14 -0
- package/dist/tools/metrics.d.ts.map +1 -0
- package/dist/tools/metrics.js +217 -0
- package/dist/tools/metrics.js.map +1 -0
- package/dist/tools/organizations.d.ts +16 -0
- package/dist/tools/organizations.d.ts.map +1 -0
- package/dist/tools/organizations.js +378 -0
- package/dist/tools/organizations.js.map +1 -0
- package/dist/tools/services.d.ts +14 -0
- package/dist/tools/services.d.ts.map +1 -0
- package/dist/tools/services.js +218 -0
- package/dist/tools/services.js.map +1 -0
- package/dist/tools/sessions.d.ts +14 -0
- package/dist/tools/sessions.d.ts.map +1 -0
- package/dist/tools/sessions.js +221 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/setup.d.ts +17 -0
- package/dist/tools/setup.d.ts.map +1 -0
- package/dist/tools/setup.js +304 -0
- package/dist/tools/setup.js.map +1 -0
- package/dist/tools/traces.d.ts +14 -0
- package/dist/tools/traces.d.ts.map +1 -0
- package/dist/tools/traces.js +350 -0
- package/dist/tools/traces.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Dashboard management MCP tools
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.registerDashboardTools = registerDashboardTools;
|
|
7
|
+
exports.handleDashboardTool = handleDashboardTool;
|
|
8
|
+
function registerDashboardTools() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
name: "list_dashboards",
|
|
12
|
+
description: `List all dashboards for the organization. Dashboards contain panels that visualize logs, metrics, and traces.
|
|
13
|
+
|
|
14
|
+
Examples:
|
|
15
|
+
- List all dashboards: list_dashboards
|
|
16
|
+
- Search by name: list_dashboards with search="production"`,
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
search: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "Optional search term to filter dashboards by name",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "get_dashboard",
|
|
29
|
+
description: "Get a specific dashboard with all its panels and configuration.",
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
dashboard_id: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "The dashboard ID to retrieve",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ["dashboard_id"],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "create_dashboard",
|
|
43
|
+
description: `Create a new dashboard. You can optionally include initial panels.
|
|
44
|
+
|
|
45
|
+
Examples:
|
|
46
|
+
- Simple dashboard: create_dashboard with name="Production Overview"
|
|
47
|
+
- With description: create_dashboard with name="API Metrics", description="Key metrics for API services"`,
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
name: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Dashboard name",
|
|
54
|
+
},
|
|
55
|
+
description: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Optional description of the dashboard's purpose",
|
|
58
|
+
},
|
|
59
|
+
panels: {
|
|
60
|
+
type: "array",
|
|
61
|
+
description: "Optional initial panels to add",
|
|
62
|
+
items: {
|
|
63
|
+
type: "object",
|
|
64
|
+
properties: {
|
|
65
|
+
title: { type: "string" },
|
|
66
|
+
type: { type: "string", enum: ["line", "bar", "table", "stat", "logs"] },
|
|
67
|
+
query: { type: "string" },
|
|
68
|
+
width: { type: "number" },
|
|
69
|
+
height: { type: "number" },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
required: ["name"],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "update_dashboard",
|
|
79
|
+
description: "Update a dashboard's name or description.",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: "object",
|
|
82
|
+
properties: {
|
|
83
|
+
dashboard_id: {
|
|
84
|
+
type: "string",
|
|
85
|
+
description: "The dashboard ID to update",
|
|
86
|
+
},
|
|
87
|
+
name: {
|
|
88
|
+
type: "string",
|
|
89
|
+
description: "New dashboard name",
|
|
90
|
+
},
|
|
91
|
+
description: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description: "New dashboard description",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
required: ["dashboard_id"],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "delete_dashboard",
|
|
101
|
+
description: "Delete a dashboard. This action cannot be undone.",
|
|
102
|
+
inputSchema: {
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
dashboard_id: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "The dashboard ID to delete",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
required: ["dashboard_id"],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "add_panel",
|
|
115
|
+
description: `Add a panel to an existing dashboard.
|
|
116
|
+
|
|
117
|
+
Panel types:
|
|
118
|
+
- line: Time series line chart
|
|
119
|
+
- bar: Bar chart
|
|
120
|
+
- table: Data table
|
|
121
|
+
- stat: Single stat display
|
|
122
|
+
- logs: Log viewer
|
|
123
|
+
|
|
124
|
+
Examples:
|
|
125
|
+
- Add error rate chart: add_panel with dashboard_id="xxx", title="Error Rate", type="line", query="error_rate{service='api'}"
|
|
126
|
+
- Add log viewer: add_panel with dashboard_id="xxx", title="Recent Errors", type="logs", query="severity:error"`,
|
|
127
|
+
inputSchema: {
|
|
128
|
+
type: "object",
|
|
129
|
+
properties: {
|
|
130
|
+
dashboard_id: {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: "The dashboard to add the panel to",
|
|
133
|
+
},
|
|
134
|
+
title: {
|
|
135
|
+
type: "string",
|
|
136
|
+
description: "Panel title",
|
|
137
|
+
},
|
|
138
|
+
type: {
|
|
139
|
+
type: "string",
|
|
140
|
+
enum: ["line", "bar", "table", "stat", "logs"],
|
|
141
|
+
description: "Panel visualization type",
|
|
142
|
+
},
|
|
143
|
+
query: {
|
|
144
|
+
type: "string",
|
|
145
|
+
description: "Query for the panel data",
|
|
146
|
+
},
|
|
147
|
+
width: {
|
|
148
|
+
type: "number",
|
|
149
|
+
description: "Panel width in grid units (1-12, default: 6)",
|
|
150
|
+
},
|
|
151
|
+
height: {
|
|
152
|
+
type: "number",
|
|
153
|
+
description: "Panel height in grid units (default: 4)",
|
|
154
|
+
},
|
|
155
|
+
position_x: {
|
|
156
|
+
type: "number",
|
|
157
|
+
description: "X position in grid (0-11)",
|
|
158
|
+
},
|
|
159
|
+
position_y: {
|
|
160
|
+
type: "number",
|
|
161
|
+
description: "Y position in grid",
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
required: ["dashboard_id", "title", "type", "query"],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "update_panel",
|
|
169
|
+
description: "Update an existing panel's configuration.",
|
|
170
|
+
inputSchema: {
|
|
171
|
+
type: "object",
|
|
172
|
+
properties: {
|
|
173
|
+
dashboard_id: {
|
|
174
|
+
type: "string",
|
|
175
|
+
description: "The dashboard containing the panel",
|
|
176
|
+
},
|
|
177
|
+
panel_id: {
|
|
178
|
+
type: "string",
|
|
179
|
+
description: "The panel ID to update",
|
|
180
|
+
},
|
|
181
|
+
title: {
|
|
182
|
+
type: "string",
|
|
183
|
+
description: "New panel title",
|
|
184
|
+
},
|
|
185
|
+
query: {
|
|
186
|
+
type: "string",
|
|
187
|
+
description: "New query",
|
|
188
|
+
},
|
|
189
|
+
width: {
|
|
190
|
+
type: "number",
|
|
191
|
+
description: "New width",
|
|
192
|
+
},
|
|
193
|
+
height: {
|
|
194
|
+
type: "number",
|
|
195
|
+
description: "New height",
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
required: ["dashboard_id", "panel_id"],
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: "delete_panel",
|
|
203
|
+
description: "Remove a panel from a dashboard.",
|
|
204
|
+
inputSchema: {
|
|
205
|
+
type: "object",
|
|
206
|
+
properties: {
|
|
207
|
+
dashboard_id: {
|
|
208
|
+
type: "string",
|
|
209
|
+
description: "The dashboard containing the panel",
|
|
210
|
+
},
|
|
211
|
+
panel_id: {
|
|
212
|
+
type: "string",
|
|
213
|
+
description: "The panel ID to delete",
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
required: ["dashboard_id", "panel_id"],
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
async function handleDashboardTool(client, toolName, args) {
|
|
222
|
+
const params = args || {};
|
|
223
|
+
switch (toolName) {
|
|
224
|
+
case "list_dashboards": {
|
|
225
|
+
const result = await client.listDashboards(params.search);
|
|
226
|
+
return {
|
|
227
|
+
content: [{
|
|
228
|
+
type: "text",
|
|
229
|
+
text: JSON.stringify({
|
|
230
|
+
count: result.dashboards.length,
|
|
231
|
+
dashboards: result.dashboards.map((d) => ({
|
|
232
|
+
id: d.id,
|
|
233
|
+
name: d.name,
|
|
234
|
+
description: d.description,
|
|
235
|
+
panel_count: d.panel_count || 0,
|
|
236
|
+
created_at: d.created_at,
|
|
237
|
+
updated_at: d.updated_at,
|
|
238
|
+
})),
|
|
239
|
+
}, null, 2),
|
|
240
|
+
}],
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
case "get_dashboard": {
|
|
244
|
+
const dashboardId = params.dashboard_id;
|
|
245
|
+
if (!dashboardId) {
|
|
246
|
+
return {
|
|
247
|
+
content: [{ type: "text", text: "dashboard_id is required" }],
|
|
248
|
+
isError: true,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
const result = await client.getDashboard(dashboardId);
|
|
252
|
+
return {
|
|
253
|
+
content: [{
|
|
254
|
+
type: "text",
|
|
255
|
+
text: JSON.stringify(result, null, 2),
|
|
256
|
+
}],
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
case "create_dashboard": {
|
|
260
|
+
const name = params.name;
|
|
261
|
+
if (!name) {
|
|
262
|
+
return {
|
|
263
|
+
content: [{ type: "text", text: "name is required" }],
|
|
264
|
+
isError: true,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
const result = await client.createDashboard({
|
|
268
|
+
name,
|
|
269
|
+
description: params.description,
|
|
270
|
+
panels: params.panels,
|
|
271
|
+
});
|
|
272
|
+
return {
|
|
273
|
+
content: [{
|
|
274
|
+
type: "text",
|
|
275
|
+
text: JSON.stringify({
|
|
276
|
+
success: true,
|
|
277
|
+
message: `Dashboard "${name}" created successfully`,
|
|
278
|
+
dashboard: result,
|
|
279
|
+
}, null, 2),
|
|
280
|
+
}],
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
case "update_dashboard": {
|
|
284
|
+
const dashboardId = params.dashboard_id;
|
|
285
|
+
if (!dashboardId) {
|
|
286
|
+
return {
|
|
287
|
+
content: [{ type: "text", text: "dashboard_id is required" }],
|
|
288
|
+
isError: true,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const result = await client.updateDashboard(dashboardId, {
|
|
292
|
+
name: params.name,
|
|
293
|
+
description: params.description,
|
|
294
|
+
});
|
|
295
|
+
return {
|
|
296
|
+
content: [{
|
|
297
|
+
type: "text",
|
|
298
|
+
text: JSON.stringify({
|
|
299
|
+
success: true,
|
|
300
|
+
message: `Dashboard updated successfully`,
|
|
301
|
+
dashboard: result,
|
|
302
|
+
}, null, 2),
|
|
303
|
+
}],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
case "delete_dashboard": {
|
|
307
|
+
const dashboardId = params.dashboard_id;
|
|
308
|
+
if (!dashboardId) {
|
|
309
|
+
return {
|
|
310
|
+
content: [{ type: "text", text: "dashboard_id is required" }],
|
|
311
|
+
isError: true,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
await client.deleteDashboard(dashboardId);
|
|
315
|
+
return {
|
|
316
|
+
content: [{
|
|
317
|
+
type: "text",
|
|
318
|
+
text: JSON.stringify({
|
|
319
|
+
success: true,
|
|
320
|
+
message: `Dashboard ${dashboardId} deleted successfully`,
|
|
321
|
+
}, null, 2),
|
|
322
|
+
}],
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
case "add_panel": {
|
|
326
|
+
const dashboardId = params.dashboard_id;
|
|
327
|
+
const title = params.title;
|
|
328
|
+
const type = params.type;
|
|
329
|
+
const query = params.query;
|
|
330
|
+
if (!dashboardId || !title || !type || !query) {
|
|
331
|
+
return {
|
|
332
|
+
content: [{ type: "text", text: "dashboard_id, title, type, and query are required" }],
|
|
333
|
+
isError: true,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
const result = await client.addPanel(dashboardId, {
|
|
337
|
+
title,
|
|
338
|
+
type,
|
|
339
|
+
query,
|
|
340
|
+
width: params.width,
|
|
341
|
+
height: params.height,
|
|
342
|
+
position_x: params.position_x,
|
|
343
|
+
position_y: params.position_y,
|
|
344
|
+
});
|
|
345
|
+
return {
|
|
346
|
+
content: [{
|
|
347
|
+
type: "text",
|
|
348
|
+
text: JSON.stringify({
|
|
349
|
+
success: true,
|
|
350
|
+
message: `Panel "${title}" added to dashboard`,
|
|
351
|
+
panel: result,
|
|
352
|
+
}, null, 2),
|
|
353
|
+
}],
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
case "update_panel": {
|
|
357
|
+
const dashboardId = params.dashboard_id;
|
|
358
|
+
const panelId = params.panel_id;
|
|
359
|
+
if (!dashboardId || !panelId) {
|
|
360
|
+
return {
|
|
361
|
+
content: [{ type: "text", text: "dashboard_id and panel_id are required" }],
|
|
362
|
+
isError: true,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
const result = await client.updatePanel(dashboardId, panelId, {
|
|
366
|
+
title: params.title,
|
|
367
|
+
query: params.query,
|
|
368
|
+
width: params.width,
|
|
369
|
+
height: params.height,
|
|
370
|
+
});
|
|
371
|
+
return {
|
|
372
|
+
content: [{
|
|
373
|
+
type: "text",
|
|
374
|
+
text: JSON.stringify({
|
|
375
|
+
success: true,
|
|
376
|
+
message: `Panel updated successfully`,
|
|
377
|
+
panel: result,
|
|
378
|
+
}, null, 2),
|
|
379
|
+
}],
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
case "delete_panel": {
|
|
383
|
+
const dashboardId = params.dashboard_id;
|
|
384
|
+
const panelId = params.panel_id;
|
|
385
|
+
if (!dashboardId || !panelId) {
|
|
386
|
+
return {
|
|
387
|
+
content: [{ type: "text", text: "dashboard_id and panel_id are required" }],
|
|
388
|
+
isError: true,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
await client.deletePanel(dashboardId, panelId);
|
|
392
|
+
return {
|
|
393
|
+
content: [{
|
|
394
|
+
type: "text",
|
|
395
|
+
text: JSON.stringify({
|
|
396
|
+
success: true,
|
|
397
|
+
message: `Panel ${panelId} deleted from dashboard`,
|
|
398
|
+
}, null, 2),
|
|
399
|
+
}],
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
default:
|
|
403
|
+
return {
|
|
404
|
+
content: [{ type: "text", text: `Unknown dashboard tool: ${toolName}` }],
|
|
405
|
+
isError: true,
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
//# sourceMappingURL=dashboards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboards.js","sourceRoot":"","sources":["../../src/tools/dashboards.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAKH,wDAoNC;AAED,kDA0NC;AAhbD,SAAgB,sBAAsB;IACpC,OAAO;QACL;YACE,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE;;;;2DAIwC;YACrD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,mDAAmD;qBACjE;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,iEAAiE;YAC9E,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,8BAA8B;qBAC5C;iBACF;gBACD,QAAQ,EAAE,CAAC,cAAc,CAAC;aAC3B;SACF;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,WAAW,EAAE;;;;yGAIsF;YACnG,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;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C,WAAW,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC7B,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,wCAAwC,EAAE,CAAC;oBAC3E,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAE/C,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,OAAO,EAAE,IAAI;4BACb,OAAO,EAAE,SAAS,OAAO,yBAAyB;yBACnD,EAAE,IAAI,EAAE,CAAC,CAAC;qBACZ,CAAC;aACH,CAAC;QACJ,CAAC;QAED;YACE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,QAAQ,EAAE,EAAE,CAAC;gBACxE,OAAO,EAAE,IAAI;aACd,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data Control Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools for managing data ingestion controls including drop filters,
|
|
5
|
+
* data retention, and cost optimization features.
|
|
6
|
+
*
|
|
7
|
+
* Drop filters allow AI agents to automatically reduce ingestion costs
|
|
8
|
+
* by filtering out noisy or unnecessary data at ingestion time.
|
|
9
|
+
*/
|
|
10
|
+
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
11
|
+
import { QorrelateClient } from "../client.js";
|
|
12
|
+
export declare function registerDataControlTools(): Tool[];
|
|
13
|
+
export declare function handleDataControlTool(client: QorrelateClient, name: string, args: Record<string, unknown>): Promise<{
|
|
14
|
+
content: Array<{
|
|
15
|
+
type: string;
|
|
16
|
+
text: string;
|
|
17
|
+
}>;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=data-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-control.d.ts","sourceRoot":"","sources":["../../src/tools/data-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,wBAAgB,wBAAwB,IAAI,IAAI,EAAE,CAmHjD;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA0F7D"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Data Control Tools
|
|
4
|
+
*
|
|
5
|
+
* Tools for managing data ingestion controls including drop filters,
|
|
6
|
+
* data retention, and cost optimization features.
|
|
7
|
+
*
|
|
8
|
+
* Drop filters allow AI agents to automatically reduce ingestion costs
|
|
9
|
+
* by filtering out noisy or unnecessary data at ingestion time.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.registerDataControlTools = registerDataControlTools;
|
|
13
|
+
exports.handleDataControlTool = handleDataControlTool;
|
|
14
|
+
function registerDataControlTools() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
name: "list_drop_filters",
|
|
18
|
+
description: `List all drop filters for an organization.
|
|
19
|
+
|
|
20
|
+
Drop filters discard data at ingestion time based on patterns, reducing storage costs.
|
|
21
|
+
Examples:
|
|
22
|
+
- Filter out DEBUG logs: filter_type=logs, query="level:DEBUG"
|
|
23
|
+
- Filter health check traces: filter_type=logs, query="service.name:health-*"
|
|
24
|
+
- Drop unused metrics: filter_type=metrics, field_name="unused_metric_*"`,
|
|
25
|
+
inputSchema: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
organization_id: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Organization ID",
|
|
31
|
+
},
|
|
32
|
+
filter_type: {
|
|
33
|
+
type: "string",
|
|
34
|
+
enum: ["logs", "metrics"],
|
|
35
|
+
description: "Optional: filter by type (logs or metrics)",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ["organization_id"],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "create_drop_filter",
|
|
43
|
+
description: `Create a new drop filter to discard data at ingestion time.
|
|
44
|
+
|
|
45
|
+
For logs, use Lucene query syntax:
|
|
46
|
+
- "level:DEBUG" - Drop all DEBUG logs
|
|
47
|
+
- "service.name:health-*" - Drop logs from health check services
|
|
48
|
+
- "level:DEBUG AND service.name:frontend" - Drop frontend DEBUG logs
|
|
49
|
+
|
|
50
|
+
For metrics, specify the metric name pattern:
|
|
51
|
+
- field_name="system.cpu.idle" - Drop specific metric
|
|
52
|
+
- field_name="test_*" - Drop all test metrics (wildcard)
|
|
53
|
+
|
|
54
|
+
This is a cost-saving feature that permanently discards matching data.`,
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
organization_id: {
|
|
59
|
+
type: "string",
|
|
60
|
+
description: "Organization ID",
|
|
61
|
+
},
|
|
62
|
+
filter_type: {
|
|
63
|
+
type: "string",
|
|
64
|
+
enum: ["logs", "metrics"],
|
|
65
|
+
description: "Type of filter: 'logs' or 'metrics'",
|
|
66
|
+
},
|
|
67
|
+
query: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "For logs: Lucene query (e.g., 'level:DEBUG', 'service.name:health-*')",
|
|
70
|
+
},
|
|
71
|
+
field_name: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "For metrics: Metric name or pattern (e.g., 'system.cpu.idle', 'test_*')",
|
|
74
|
+
},
|
|
75
|
+
condition: {
|
|
76
|
+
type: "string",
|
|
77
|
+
enum: ["equals", "contains", "starts_with", "ends_with", "regex"],
|
|
78
|
+
description: "How to match the value (default: equals)",
|
|
79
|
+
},
|
|
80
|
+
value: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "Value to match against (for metrics with conditions)",
|
|
83
|
+
},
|
|
84
|
+
label_name: {
|
|
85
|
+
type: "string",
|
|
86
|
+
description: "Optional: label name for metric filtering (e.g., 'environment')",
|
|
87
|
+
},
|
|
88
|
+
label_value: {
|
|
89
|
+
type: "string",
|
|
90
|
+
description: "Optional: label value to match (e.g., 'staging')",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
required: ["organization_id", "filter_type"],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "delete_drop_filter",
|
|
98
|
+
description: "Delete an existing drop filter by ID. Data will no longer be filtered after deletion.",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
organization_id: {
|
|
103
|
+
type: "string",
|
|
104
|
+
description: "Organization ID",
|
|
105
|
+
},
|
|
106
|
+
filter_id: {
|
|
107
|
+
type: "string",
|
|
108
|
+
description: "ID of the drop filter to delete",
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
required: ["organization_id", "filter_id"],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "get_drop_filter_stats",
|
|
116
|
+
description: "Get statistics on how much data each drop filter has discarded. Useful for understanding cost savings.",
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {
|
|
120
|
+
organization_id: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "Organization ID",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
required: ["organization_id"],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
async function handleDataControlTool(client, name, args) {
|
|
131
|
+
const orgId = args.organization_id;
|
|
132
|
+
switch (name) {
|
|
133
|
+
case "list_drop_filters": {
|
|
134
|
+
const filterType = args.filter_type;
|
|
135
|
+
const result = await client.listDropFilters(orgId, filterType);
|
|
136
|
+
return {
|
|
137
|
+
content: [
|
|
138
|
+
{
|
|
139
|
+
type: "text",
|
|
140
|
+
text: JSON.stringify(result, null, 2),
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
case "create_drop_filter": {
|
|
146
|
+
const params = {
|
|
147
|
+
filter_type: args.filter_type,
|
|
148
|
+
query: args.query,
|
|
149
|
+
field_name: args.field_name,
|
|
150
|
+
condition: args.condition,
|
|
151
|
+
value: args.value,
|
|
152
|
+
label_name: args.label_name,
|
|
153
|
+
label_value: args.label_value,
|
|
154
|
+
};
|
|
155
|
+
// Validate
|
|
156
|
+
if (params.filter_type === 'logs' && !params.query) {
|
|
157
|
+
return {
|
|
158
|
+
content: [
|
|
159
|
+
{
|
|
160
|
+
type: "text",
|
|
161
|
+
text: "Error: 'query' is required for log filters. Use Lucene syntax like 'level:DEBUG' or 'service.name:health-*'",
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (params.filter_type === 'metrics' && !params.field_name) {
|
|
167
|
+
return {
|
|
168
|
+
content: [
|
|
169
|
+
{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: "Error: 'field_name' (metric name) is required for metric filters.",
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const result = await client.createDropFilter(orgId, params);
|
|
177
|
+
return {
|
|
178
|
+
content: [
|
|
179
|
+
{
|
|
180
|
+
type: "text",
|
|
181
|
+
text: `Drop filter created successfully!\n\n${JSON.stringify(result, null, 2)}\n\n⚠️ Note: Matching data will be permanently discarded from now on.`,
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
case "delete_drop_filter": {
|
|
187
|
+
const filterId = args.filter_id;
|
|
188
|
+
const result = await client.deleteDropFilter(orgId, filterId);
|
|
189
|
+
return {
|
|
190
|
+
content: [
|
|
191
|
+
{
|
|
192
|
+
type: "text",
|
|
193
|
+
text: `Drop filter deleted.\n\n${JSON.stringify(result, null, 2)}`,
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
case "get_drop_filter_stats": {
|
|
199
|
+
const result = await client.getDropFilterStats(orgId);
|
|
200
|
+
return {
|
|
201
|
+
content: [
|
|
202
|
+
{
|
|
203
|
+
type: "text",
|
|
204
|
+
text: JSON.stringify(result, null, 2),
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
default:
|
|
210
|
+
throw new Error(`Unknown data control tool: ${name}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=data-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-control.js","sourceRoot":"","sources":["../../src/tools/data-control.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAKH,4DAmHC;AAED,sDA8FC;AAnND,SAAgB,wBAAwB;IACtC,OAAO;QACL;YACE,IAAI,EAAE,mBAAmB;YACzB,WAAW,EAAE;;;;;;yEAMsD;YACnE,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,eAAe,EAAE;wBACf,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iBAAiB;qBAC/B;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;wBACzB,WAAW,EAAE,4CAA4C;qBAC1D;iB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