datadog-mcp 2.0.1 → 3.0.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 +18 -0
- package/dist/index.js +73 -67
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,12 @@ DD_APP_KEY=your-app-key
|
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
DD_SITE=datadoghq.com # Default. Use datadoghq.eu for EU, etc.
|
|
26
|
+
|
|
27
|
+
# Limit defaults (fallbacks when AI doesn't specify)
|
|
28
|
+
MCP_DEFAULT_LIMIT=50 # General tools default limit
|
|
29
|
+
MCP_DEFAULT_LOG_LINES=200 # Logs tool default limit
|
|
30
|
+
MCP_DEFAULT_METRIC_POINTS=1000 # Metrics timeseries data points
|
|
31
|
+
MCP_DEFAULT_TIME_RANGE=24 # Default time range in hours
|
|
26
32
|
```
|
|
27
33
|
|
|
28
34
|
### Optional Flags
|
|
@@ -205,6 +211,18 @@ When running with `--transport=http`:
|
|
|
205
211
|
|
|
206
212
|
## Token Efficiency
|
|
207
213
|
|
|
214
|
+
### Limit Control
|
|
215
|
+
|
|
216
|
+
AI assistants have full control over query limits. The environment variables set what value is used when the AI doesn't specify a limit. They do NOT cap what the AI can request.
|
|
217
|
+
|
|
218
|
+
| Tool | Default | Parameter | Description |
|
|
219
|
+
|------|---------|-----------|-------------|
|
|
220
|
+
| Logs | 200 | `limit` | Log lines to return |
|
|
221
|
+
| Metrics (timeseries) | 1000 | `pointLimit` | Data points per series (controls resolution) |
|
|
222
|
+
| General tools | 50 | `limit` | Results to return |
|
|
223
|
+
|
|
224
|
+
Defaults can be configured via `MCP_DEFAULT_*` environment variables.
|
|
225
|
+
|
|
208
226
|
### Compact Mode (Logs)
|
|
209
227
|
|
|
210
228
|
Use `compact: true` when searching logs to reduce token usage. Strips custom attributes and keeps only essential fields:
|
package/dist/index.js
CHANGED
|
@@ -37,12 +37,12 @@ var configSchema = z.object({
|
|
|
37
37
|
host: z.string().default("localhost")
|
|
38
38
|
}).default({}),
|
|
39
39
|
limits: z.object({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
defaultLimit: z.number().default(50),
|
|
41
|
+
// Fallback when AI doesn't specify limit
|
|
42
|
+
defaultLogLines: z.number().default(200),
|
|
43
|
+
// Fallback when AI doesn't specify log limit
|
|
44
|
+
defaultMetricDataPoints: z.number().default(1e3),
|
|
45
|
+
// Fallback for timeseries data points
|
|
46
46
|
defaultTimeRangeHours: z.number().default(24)
|
|
47
47
|
}).default({}),
|
|
48
48
|
features: z.object({
|
|
@@ -115,9 +115,9 @@ function loadConfig() {
|
|
|
115
115
|
host: args.strings.host ?? process.env.MCP_HOST ?? "localhost"
|
|
116
116
|
},
|
|
117
117
|
limits: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
defaultLimit: Number.parseInt(process.env.MCP_DEFAULT_LIMIT ?? "50", 10),
|
|
119
|
+
defaultLogLines: Number.parseInt(process.env.MCP_DEFAULT_LOG_LINES ?? "200", 10),
|
|
120
|
+
defaultMetricDataPoints: Number.parseInt(process.env.MCP_DEFAULT_METRIC_POINTS ?? "1000", 10),
|
|
121
121
|
defaultTimeRangeHours: Number.parseInt(process.env.MCP_DEFAULT_TIME_RANGE ?? "24", 10)
|
|
122
122
|
},
|
|
123
123
|
features: {
|
|
@@ -394,7 +394,7 @@ var InputSchema = {
|
|
|
394
394
|
groupStates: z2.array(z2.string()).optional().describe(
|
|
395
395
|
"Filter multi-alert monitors by group states (e.g., alert by host). Does NOT filter by overall monitor status. Values: alert, warn, no data, ok"
|
|
396
396
|
),
|
|
397
|
-
limit: z2.number().optional().describe("Maximum number of monitors to return"),
|
|
397
|
+
limit: z2.number().min(1).optional().describe("Maximum number of monitors to return (default: 50)"),
|
|
398
398
|
config: z2.record(z2.unknown()).optional().describe("Monitor configuration (for create/update)"),
|
|
399
399
|
message: z2.string().optional().describe("Mute message (for mute action)"),
|
|
400
400
|
end: z2.number().optional().describe("Mute end timestamp (for mute action)")
|
|
@@ -415,7 +415,7 @@ function formatMonitor(m, site = "datadoghq.com") {
|
|
|
415
415
|
};
|
|
416
416
|
}
|
|
417
417
|
async function listMonitors(api, params, limits, site) {
|
|
418
|
-
const effectiveLimit =
|
|
418
|
+
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
419
419
|
const response = await api.listMonitors({
|
|
420
420
|
name: params.name,
|
|
421
421
|
tags: params.tags?.join(","),
|
|
@@ -451,7 +451,7 @@ async function getMonitor(api, id, site) {
|
|
|
451
451
|
}
|
|
452
452
|
async function searchMonitors(api, query, limits, site) {
|
|
453
453
|
const response = await api.searchMonitors({ query });
|
|
454
|
-
const monitors = (response.monitors ?? []).
|
|
454
|
+
const monitors = (response.monitors ?? []).map((m) => ({
|
|
455
455
|
id: m.id ?? 0,
|
|
456
456
|
name: m.name ?? "",
|
|
457
457
|
status: String(m.status ?? "unknown"),
|
|
@@ -632,7 +632,7 @@ var InputSchema2 = {
|
|
|
632
632
|
id: z3.string().optional().describe("Dashboard ID (required for get/update/delete)"),
|
|
633
633
|
name: z3.string().optional().describe("Filter by name"),
|
|
634
634
|
tags: z3.array(z3.string()).optional().describe("Filter by tags"),
|
|
635
|
-
limit: z3.number().optional().describe("Maximum number of dashboards to return"),
|
|
635
|
+
limit: z3.number().min(1).optional().describe("Maximum number of dashboards to return (default: 50)"),
|
|
636
636
|
config: z3.record(z3.unknown()).optional().describe("Dashboard configuration (for create/update)")
|
|
637
637
|
};
|
|
638
638
|
function formatDashboardSummary(d) {
|
|
@@ -648,7 +648,7 @@ function formatDashboardSummary(d) {
|
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
650
|
async function listDashboards(api, params, limits) {
|
|
651
|
-
const effectiveLimit =
|
|
651
|
+
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
652
652
|
const response = await api.listDashboards({
|
|
653
653
|
filterShared: false
|
|
654
654
|
});
|
|
@@ -914,7 +914,7 @@ var InputSchema3 = {
|
|
|
914
914
|
host: z4.string().optional().describe("Filter by host"),
|
|
915
915
|
status: z4.enum(["error", "warn", "info", "debug"]).optional().describe("Filter by log status/level"),
|
|
916
916
|
indexes: z4.array(z4.string()).optional().describe("Log indexes to search"),
|
|
917
|
-
limit: z4.number().optional().describe("Maximum number of logs to return"),
|
|
917
|
+
limit: z4.number().min(1).optional().describe("Maximum number of logs to return (default: 200)"),
|
|
918
918
|
sort: z4.enum(["timestamp", "-timestamp"]).optional().describe("Sort order"),
|
|
919
919
|
sample: z4.enum(["first", "spread", "diverse"]).optional().describe(
|
|
920
920
|
"Sampling mode: first (chronological, default), spread (evenly across time range), diverse (distinct message patterns)"
|
|
@@ -1009,6 +1009,7 @@ function diverseSample(items, limit) {
|
|
|
1009
1009
|
patterns: seen.size
|
|
1010
1010
|
};
|
|
1011
1011
|
}
|
|
1012
|
+
var SAMPLE_DIVERSITY_MULTIPLIER = 4;
|
|
1012
1013
|
function buildLogQuery(params) {
|
|
1013
1014
|
const parts = [];
|
|
1014
1015
|
if (params.query) {
|
|
@@ -1050,10 +1051,10 @@ async function searchLogs(api, params, limits, site) {
|
|
|
1050
1051
|
host: params.host,
|
|
1051
1052
|
status: params.status
|
|
1052
1053
|
});
|
|
1053
|
-
const requestedLimit = params.limit ?? limits.
|
|
1054
|
+
const requestedLimit = params.limit ?? limits.defaultLogLines;
|
|
1054
1055
|
const sampleMode = params.sample ?? "first";
|
|
1055
|
-
const fetchMultiplier = sampleMode === "first" ? 1 :
|
|
1056
|
-
const fetchLimit =
|
|
1056
|
+
const fetchMultiplier = sampleMode === "first" ? 1 : SAMPLE_DIVERSITY_MULTIPLIER;
|
|
1057
|
+
const fetchLimit = requestedLimit * fetchMultiplier;
|
|
1057
1058
|
const body = {
|
|
1058
1059
|
filter: {
|
|
1059
1060
|
query: fullQuery,
|
|
@@ -1226,7 +1227,10 @@ var InputSchema4 = {
|
|
|
1226
1227
|
to: z5.string().optional().describe('End time (ONLY for query action). Same formats as "from".'),
|
|
1227
1228
|
metric: z5.string().optional().describe("Metric name (for metadata action)"),
|
|
1228
1229
|
tag: z5.string().optional().describe("Filter by tag"),
|
|
1229
|
-
limit: z5.number().optional().describe("Maximum number of results (for search/list)")
|
|
1230
|
+
limit: z5.number().min(1).optional().describe("Maximum number of results (for search/list, default: 50)"),
|
|
1231
|
+
pointLimit: z5.number().min(1).optional().describe(
|
|
1232
|
+
"Maximum data points per timeseries (for query action). AI controls resolution vs token usage (default: 1000)."
|
|
1233
|
+
)
|
|
1230
1234
|
};
|
|
1231
1235
|
async function queryMetrics(api, params, limits, site) {
|
|
1232
1236
|
const defaultFrom = hoursAgo(limits.defaultTimeRangeHours);
|
|
@@ -1242,7 +1246,7 @@ async function queryMetrics(api, params, limits, site) {
|
|
|
1242
1246
|
});
|
|
1243
1247
|
const series = (response.series ?? []).map((s) => ({
|
|
1244
1248
|
metric: s.metric ?? "",
|
|
1245
|
-
points: (s.pointlist ?? []).slice(0, limits.
|
|
1249
|
+
points: (s.pointlist ?? []).slice(0, params.pointLimit ?? limits.defaultMetricDataPoints).map((p) => ({
|
|
1246
1250
|
timestamp: p[0] ?? 0,
|
|
1247
1251
|
value: p[1] ?? 0
|
|
1248
1252
|
})),
|
|
@@ -1269,20 +1273,20 @@ async function searchMetrics(api, params, limits) {
|
|
|
1269
1273
|
});
|
|
1270
1274
|
const allMetrics = response.metrics ?? [];
|
|
1271
1275
|
const lowerQuery = params.query.toLowerCase();
|
|
1272
|
-
const filtered = allMetrics.filter((name) => name.toLowerCase().includes(lowerQuery)).slice(0, params.limit ?? limits.
|
|
1276
|
+
const filtered = allMetrics.filter((name) => name.toLowerCase().includes(lowerQuery)).slice(0, params.limit ?? limits.defaultLimit);
|
|
1273
1277
|
return {
|
|
1274
1278
|
metrics: filtered,
|
|
1275
1279
|
total: filtered.length,
|
|
1276
1280
|
searchedFrom: allMetrics.length
|
|
1277
1281
|
};
|
|
1278
1282
|
}
|
|
1279
|
-
async function listMetrics(api, params,
|
|
1283
|
+
async function listMetrics(api, params, _limits) {
|
|
1280
1284
|
const response = await api.listActiveMetrics({
|
|
1281
1285
|
from: hoursAgo(24),
|
|
1282
1286
|
host: void 0,
|
|
1283
1287
|
tagFilter: params.query
|
|
1284
1288
|
});
|
|
1285
|
-
const metrics =
|
|
1289
|
+
const metrics = response.metrics ?? [];
|
|
1286
1290
|
return {
|
|
1287
1291
|
metrics,
|
|
1288
1292
|
total: response.metrics?.length ?? 0
|
|
@@ -1315,7 +1319,7 @@ APM METRICS (auto-generated from traces):
|
|
|
1315
1319
|
- trace.{service}.duration - Latency (use avg:, p95:, max:)
|
|
1316
1320
|
Example: max:trace.{service}.request.duration{*}`,
|
|
1317
1321
|
InputSchema4,
|
|
1318
|
-
async ({ action, query, from, to, metric, limit }) => {
|
|
1322
|
+
async ({ action, query, from, to, metric, limit, pointLimit }) => {
|
|
1319
1323
|
try {
|
|
1320
1324
|
switch (action) {
|
|
1321
1325
|
case "query": {
|
|
@@ -1326,7 +1330,8 @@ Example: max:trace.{service}.request.duration{*}`,
|
|
|
1326
1330
|
{
|
|
1327
1331
|
query: metricsQuery,
|
|
1328
1332
|
from,
|
|
1329
|
-
to
|
|
1333
|
+
to,
|
|
1334
|
+
pointLimit
|
|
1330
1335
|
},
|
|
1331
1336
|
limits,
|
|
1332
1337
|
site
|
|
@@ -1401,7 +1406,7 @@ var InputSchema5 = {
|
|
|
1401
1406
|
),
|
|
1402
1407
|
errorType: z6.string().optional().describe('Filter by error type (grep-like). Example: "TimeoutError", "ConnectionRefused"'),
|
|
1403
1408
|
errorMessage: z6.string().optional().describe('Filter by error message (grep-like). Example: "timeout", "connection refused"'),
|
|
1404
|
-
limit: z6.number().optional().describe("Maximum number of results"),
|
|
1409
|
+
limit: z6.number().min(1).optional().describe("Maximum number of results (default: 50)"),
|
|
1405
1410
|
sort: z6.enum(["timestamp", "-timestamp"]).optional().describe("Sort order"),
|
|
1406
1411
|
groupBy: z6.array(z6.string()).optional().describe('Fields to group by (for aggregate). Example: ["resource_name", "status"]')
|
|
1407
1412
|
};
|
|
@@ -1541,7 +1546,7 @@ async function searchTraces(api, params, limits, site) {
|
|
|
1541
1546
|
},
|
|
1542
1547
|
sort: params.sort === "timestamp" ? "timestamp" : "-timestamp",
|
|
1543
1548
|
page: {
|
|
1544
|
-
limit:
|
|
1549
|
+
limit: params.limit ?? limits.defaultLimit
|
|
1545
1550
|
}
|
|
1546
1551
|
}
|
|
1547
1552
|
}
|
|
@@ -1633,7 +1638,7 @@ async function listApmServices(api, params, limits) {
|
|
|
1633
1638
|
groupBy: [
|
|
1634
1639
|
{
|
|
1635
1640
|
facet: "service",
|
|
1636
|
-
limit: limits.
|
|
1641
|
+
limit: limits.defaultLimit
|
|
1637
1642
|
}
|
|
1638
1643
|
]
|
|
1639
1644
|
}
|
|
@@ -1767,7 +1772,7 @@ var InputSchema6 = {
|
|
|
1767
1772
|
priority: z7.enum(["normal", "low"]).optional().describe("Event priority"),
|
|
1768
1773
|
sources: z7.array(z7.string()).optional().describe("Filter by sources"),
|
|
1769
1774
|
tags: z7.array(z7.string()).optional().describe("Filter by tags"),
|
|
1770
|
-
limit: z7.number().optional().describe("Maximum number of events to return"),
|
|
1775
|
+
limit: z7.number().min(1).optional().describe("Maximum number of events to return (default: 50)"),
|
|
1771
1776
|
title: z7.string().optional().describe("Event title (for create)"),
|
|
1772
1777
|
text: z7.string().optional().describe("Event text (for create)"),
|
|
1773
1778
|
alertType: z7.enum(["error", "warning", "info", "success"]).optional().describe("Alert type (for create)"),
|
|
@@ -1902,7 +1907,7 @@ function formatEventV2(e) {
|
|
|
1902
1907
|
};
|
|
1903
1908
|
}
|
|
1904
1909
|
async function listEventsV1(api, params, limits) {
|
|
1905
|
-
const effectiveLimit =
|
|
1910
|
+
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
1906
1911
|
const defaultFrom = hoursAgo(limits.defaultTimeRangeHours);
|
|
1907
1912
|
const defaultTo = now();
|
|
1908
1913
|
const response = await api.listEvents({
|
|
@@ -1986,7 +1991,7 @@ async function searchEventsV2(api, params, limits, site) {
|
|
|
1986
1991
|
tags: params.tags,
|
|
1987
1992
|
priority: params.priority
|
|
1988
1993
|
});
|
|
1989
|
-
const effectiveLimit =
|
|
1994
|
+
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
1990
1995
|
const body = {
|
|
1991
1996
|
filter: {
|
|
1992
1997
|
query: fullQuery,
|
|
@@ -2358,13 +2363,13 @@ async function incidentsEventsV2(api, params, limits, site) {
|
|
|
2358
2363
|
};
|
|
2359
2364
|
}
|
|
2360
2365
|
async function enrichWithMonitorMetadata(events, monitorsApi) {
|
|
2361
|
-
const
|
|
2366
|
+
const monitorIds = /* @__PURE__ */ new Set();
|
|
2362
2367
|
for (const event of events) {
|
|
2363
|
-
if (event.
|
|
2364
|
-
|
|
2368
|
+
if (event.monitorId) {
|
|
2369
|
+
monitorIds.add(event.monitorId);
|
|
2365
2370
|
}
|
|
2366
2371
|
}
|
|
2367
|
-
if (
|
|
2372
|
+
if (monitorIds.size === 0) {
|
|
2368
2373
|
return events;
|
|
2369
2374
|
}
|
|
2370
2375
|
const monitorCache = /* @__PURE__ */ new Map();
|
|
@@ -2374,8 +2379,8 @@ async function enrichWithMonitorMetadata(events, monitorsApi) {
|
|
|
2374
2379
|
});
|
|
2375
2380
|
const monitors = response ?? [];
|
|
2376
2381
|
for (const monitor of monitors) {
|
|
2377
|
-
if (monitor.
|
|
2378
|
-
monitorCache.set(monitor.
|
|
2382
|
+
if (monitor.id && monitorIds.has(monitor.id)) {
|
|
2383
|
+
monitorCache.set(monitor.id, monitor);
|
|
2379
2384
|
}
|
|
2380
2385
|
}
|
|
2381
2386
|
} catch {
|
|
@@ -2383,11 +2388,12 @@ async function enrichWithMonitorMetadata(events, monitorsApi) {
|
|
|
2383
2388
|
}
|
|
2384
2389
|
return events.map((event) => {
|
|
2385
2390
|
const enriched = { ...event };
|
|
2386
|
-
if (event.
|
|
2387
|
-
const monitor = monitorCache.get(event.
|
|
2391
|
+
if (event.monitorId) {
|
|
2392
|
+
const monitor = monitorCache.get(event.monitorId);
|
|
2388
2393
|
if (monitor) {
|
|
2389
2394
|
enriched.monitorMetadata = {
|
|
2390
2395
|
id: monitor.id ?? 0,
|
|
2396
|
+
name: monitor.name ?? "",
|
|
2391
2397
|
type: String(monitor.type ?? ""),
|
|
2392
2398
|
message: monitor.message ?? "",
|
|
2393
2399
|
tags: monitor.tags ?? [],
|
|
@@ -2580,7 +2586,7 @@ var InputSchema7 = {
|
|
|
2580
2586
|
id: z8.string().optional().describe("Incident ID (required for get/update/delete)"),
|
|
2581
2587
|
query: z8.string().optional().describe("Search query (for search action)"),
|
|
2582
2588
|
status: z8.enum(["active", "stable", "resolved"]).optional().describe("Filter by status (for list)"),
|
|
2583
|
-
limit: z8.number().optional().describe("Maximum number of incidents to return"),
|
|
2589
|
+
limit: z8.number().min(1).optional().describe("Maximum number of incidents to return (default: 50)"),
|
|
2584
2590
|
config: z8.record(z8.unknown()).optional().describe(
|
|
2585
2591
|
"Incident configuration (for create/update). Create requires: title. Update can modify: title, status, severity, fields."
|
|
2586
2592
|
)
|
|
@@ -2610,7 +2616,7 @@ function formatIncident(i) {
|
|
|
2610
2616
|
};
|
|
2611
2617
|
}
|
|
2612
2618
|
async function listIncidents(api, params, limits) {
|
|
2613
|
-
const effectiveLimit =
|
|
2619
|
+
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
2614
2620
|
const response = await api.listIncidents({
|
|
2615
2621
|
pageSize: effectiveLimit
|
|
2616
2622
|
});
|
|
@@ -2633,7 +2639,7 @@ async function getIncident(api, id) {
|
|
|
2633
2639
|
async function searchIncidents(api, query, limits) {
|
|
2634
2640
|
const response = await api.searchIncidents({
|
|
2635
2641
|
query,
|
|
2636
|
-
pageSize: limits.
|
|
2642
|
+
pageSize: limits.defaultLimit
|
|
2637
2643
|
});
|
|
2638
2644
|
const incidents = (response.data?.attributes?.incidents ?? []).map(
|
|
2639
2645
|
(i) => ({
|
|
@@ -2732,7 +2738,7 @@ var InputSchema8 = {
|
|
|
2732
2738
|
ids: z9.array(z9.string()).optional().describe("Multiple SLO IDs (for list with specific IDs)"),
|
|
2733
2739
|
query: z9.string().optional().describe("Search query (for list)"),
|
|
2734
2740
|
tags: z9.array(z9.string()).optional().describe("Filter by tags (for list)"),
|
|
2735
|
-
limit: z9.number().optional().describe("Maximum number of SLOs to return"),
|
|
2741
|
+
limit: z9.number().min(1).optional().describe("Maximum number of SLOs to return (default: 50)"),
|
|
2736
2742
|
config: z9.record(z9.unknown()).optional().describe("SLO configuration (for create/update). Must include type, name, thresholds."),
|
|
2737
2743
|
from: z9.string().optional().describe('Start time for history (ISO 8601 or relative like "7d", "1w")'),
|
|
2738
2744
|
to: z9.string().optional().describe("End time for history (ISO 8601 or relative, default: now)")
|
|
@@ -2759,7 +2765,7 @@ function formatSlo(s) {
|
|
|
2759
2765
|
};
|
|
2760
2766
|
}
|
|
2761
2767
|
async function listSlos(api, params, limits) {
|
|
2762
|
-
const effectiveLimit =
|
|
2768
|
+
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
2763
2769
|
const response = await api.listSLOs({
|
|
2764
2770
|
ids: params.ids?.join(","),
|
|
2765
2771
|
query: params.query,
|
|
@@ -2910,7 +2916,7 @@ var InputSchema9 = {
|
|
|
2910
2916
|
testType: z10.enum(["api", "browser"]).optional().describe("Test type filter (for list) or type for create"),
|
|
2911
2917
|
locations: z10.array(z10.string()).optional().describe("Filter by locations (for list)"),
|
|
2912
2918
|
tags: z10.array(z10.string()).optional().describe("Filter by tags (for list)"),
|
|
2913
|
-
limit: z10.number().optional().describe("Maximum number of tests to return"),
|
|
2919
|
+
limit: z10.number().min(1).optional().describe("Maximum number of tests to return (default: 50)"),
|
|
2914
2920
|
config: z10.record(z10.unknown()).optional().describe(
|
|
2915
2921
|
"Test configuration (for create/update). Includes: name, type, config, options, locations, message."
|
|
2916
2922
|
)
|
|
@@ -2929,7 +2935,7 @@ function formatTest(t) {
|
|
|
2929
2935
|
};
|
|
2930
2936
|
}
|
|
2931
2937
|
async function listTests(api, params, limits) {
|
|
2932
|
-
const effectiveLimit =
|
|
2938
|
+
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
2933
2939
|
const response = await api.listTests({
|
|
2934
2940
|
pageSize: effectiveLimit
|
|
2935
2941
|
});
|
|
@@ -3129,7 +3135,7 @@ var InputSchema10 = {
|
|
|
3129
3135
|
action: ActionSchema10.describe("Action to perform"),
|
|
3130
3136
|
filter: z11.string().optional().describe('Filter hosts by name, alias, or tag (e.g., "env:prod")'),
|
|
3131
3137
|
from: z11.number().optional().describe("Starting offset for pagination"),
|
|
3132
|
-
count: z11.number().optional().describe("Number of hosts to return"),
|
|
3138
|
+
count: z11.number().min(1).optional().describe("Number of hosts to return"),
|
|
3133
3139
|
sortField: z11.string().optional().describe('Field to sort by (e.g., "apps", "cpu", "name")'),
|
|
3134
3140
|
sortDir: z11.enum(["asc", "desc"]).optional().describe("Sort direction"),
|
|
3135
3141
|
hostName: z11.string().optional().describe("Host name (required for mute/unmute)"),
|
|
@@ -3158,7 +3164,7 @@ async function listHosts(api, params, limits) {
|
|
|
3158
3164
|
const response = await api.listHosts({
|
|
3159
3165
|
filter: params.filter,
|
|
3160
3166
|
from: params.from,
|
|
3161
|
-
count:
|
|
3167
|
+
count: params.count ?? limits.defaultLimit,
|
|
3162
3168
|
sortField: params.sortField,
|
|
3163
3169
|
sortDir: params.sortDir
|
|
3164
3170
|
});
|
|
@@ -3252,7 +3258,7 @@ var InputSchema11 = {
|
|
|
3252
3258
|
id: z12.string().optional().describe("Downtime ID (required for get/update/cancel)"),
|
|
3253
3259
|
monitorId: z12.number().optional().describe("Monitor ID (required for listByMonitor)"),
|
|
3254
3260
|
currentOnly: z12.boolean().optional().describe("Only return active downtimes (for list)"),
|
|
3255
|
-
limit: z12.number().optional().describe("Maximum number of downtimes to return"),
|
|
3261
|
+
limit: z12.number().min(1).optional().describe("Maximum number of downtimes to return (default: 50)"),
|
|
3256
3262
|
config: z12.record(z12.unknown()).optional().describe("Downtime configuration (for create/update). Must include scope and schedule.")
|
|
3257
3263
|
};
|
|
3258
3264
|
function extractMonitorIdentifier(mi) {
|
|
@@ -3281,7 +3287,7 @@ function formatDowntime(d) {
|
|
|
3281
3287
|
};
|
|
3282
3288
|
}
|
|
3283
3289
|
async function listDowntimes(api, params, limits) {
|
|
3284
|
-
const effectiveLimit =
|
|
3290
|
+
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
3285
3291
|
const response = await api.listDowntimes({
|
|
3286
3292
|
currentOnly: params.currentOnly
|
|
3287
3293
|
});
|
|
@@ -3386,9 +3392,9 @@ function formatMonitorDowntime(d) {
|
|
|
3386
3392
|
end: attrs?.end ? new Date(attrs.end).toISOString() : null
|
|
3387
3393
|
};
|
|
3388
3394
|
}
|
|
3389
|
-
async function listMonitorDowntimes(api, monitorId,
|
|
3395
|
+
async function listMonitorDowntimes(api, monitorId, _limits) {
|
|
3390
3396
|
const response = await api.listMonitorDowntimes({ monitorId });
|
|
3391
|
-
const downtimes = (response.data ?? []).
|
|
3397
|
+
const downtimes = (response.data ?? []).map(formatMonitorDowntime);
|
|
3392
3398
|
return {
|
|
3393
3399
|
downtimes,
|
|
3394
3400
|
monitorId,
|
|
@@ -3447,7 +3453,7 @@ var InputSchema12 = {
|
|
|
3447
3453
|
to: z13.string().optional().describe('End time (ISO 8601, relative like "now", or precise timestamp)'),
|
|
3448
3454
|
type: z13.enum(["all", "view", "action", "error", "long_task", "resource"]).optional().describe("RUM event type filter"),
|
|
3449
3455
|
sort: z13.enum(["timestamp", "-timestamp"]).optional().describe("Sort order for events"),
|
|
3450
|
-
limit: z13.number().optional().describe("Maximum number of events to return"),
|
|
3456
|
+
limit: z13.number().min(1).optional().describe("Maximum number of events to return (default: 50)"),
|
|
3451
3457
|
groupBy: z13.array(z13.string()).optional().describe('Fields to group by for aggregation (e.g., ["@view.url_path", "@session.type"])'),
|
|
3452
3458
|
compute: z13.object({
|
|
3453
3459
|
aggregation: z13.enum(["count", "cardinality", "avg", "sum", "min", "max", "percentile"]).optional(),
|
|
@@ -3549,7 +3555,7 @@ async function searchEvents(api, params, limits, site) {
|
|
|
3549
3555
|
filterFrom: new Date(fromTime * 1e3),
|
|
3550
3556
|
filterTo: new Date(toTime * 1e3),
|
|
3551
3557
|
sort: params.sort === "timestamp" ? "timestamp" : "-timestamp",
|
|
3552
|
-
pageLimit:
|
|
3558
|
+
pageLimit: params.limit ?? limits.defaultLimit
|
|
3553
3559
|
});
|
|
3554
3560
|
const events = (response.data ?? []).map(formatEvent);
|
|
3555
3561
|
return {
|
|
@@ -3766,7 +3772,7 @@ async function getSessionWaterfall(api, params, limits, site) {
|
|
|
3766
3772
|
const response = await api.listRUMEvents({
|
|
3767
3773
|
filterQuery: queryParts.join(" "),
|
|
3768
3774
|
sort: "timestamp",
|
|
3769
|
-
pageLimit:
|
|
3775
|
+
pageLimit: limits.defaultLimit
|
|
3770
3776
|
});
|
|
3771
3777
|
const events = (response.data ?? []).map(formatWaterfallEvent);
|
|
3772
3778
|
const summary = {
|
|
@@ -3852,7 +3858,7 @@ var InputSchema13 = {
|
|
|
3852
3858
|
to: z14.string().optional().describe('End time (ISO 8601, relative like "now")'),
|
|
3853
3859
|
severity: z14.enum(["info", "low", "medium", "high", "critical"]).optional().describe("Filter by severity"),
|
|
3854
3860
|
status: z14.enum(["open", "under_review", "archived"]).optional().describe("Filter signals by status"),
|
|
3855
|
-
pageSize: z14.number().optional().describe("Number of results to return"),
|
|
3861
|
+
pageSize: z14.number().min(1).optional().describe("Number of results to return"),
|
|
3856
3862
|
pageCursor: z14.string().optional().describe("Cursor for pagination")
|
|
3857
3863
|
};
|
|
3858
3864
|
function formatRule(rule) {
|
|
@@ -3894,7 +3900,7 @@ function formatSignal(signal) {
|
|
|
3894
3900
|
}
|
|
3895
3901
|
async function listRules(api, params, limits) {
|
|
3896
3902
|
const response = await api.listSecurityMonitoringRules({
|
|
3897
|
-
pageSize:
|
|
3903
|
+
pageSize: params.pageSize ?? limits.defaultLimit,
|
|
3898
3904
|
pageNumber: 0
|
|
3899
3905
|
});
|
|
3900
3906
|
const rules = (response.data ?? []).map(formatRule);
|
|
@@ -3931,7 +3937,7 @@ async function searchSignals(api, params, limits) {
|
|
|
3931
3937
|
to: new Date(toTime * 1e3)
|
|
3932
3938
|
},
|
|
3933
3939
|
page: {
|
|
3934
|
-
limit:
|
|
3940
|
+
limit: params.pageSize ?? limits.defaultLimit,
|
|
3935
3941
|
cursor: params.pageCursor
|
|
3936
3942
|
},
|
|
3937
3943
|
sort: "timestamp"
|
|
@@ -3960,7 +3966,7 @@ async function listFindings(api, params, limits) {
|
|
|
3960
3966
|
to: /* @__PURE__ */ new Date()
|
|
3961
3967
|
},
|
|
3962
3968
|
page: {
|
|
3963
|
-
limit:
|
|
3969
|
+
limit: params.pageSize ?? limits.defaultLimit,
|
|
3964
3970
|
cursor: params.pageCursor
|
|
3965
3971
|
}
|
|
3966
3972
|
}
|
|
@@ -4037,7 +4043,7 @@ var InputSchema14 = {
|
|
|
4037
4043
|
end: z15.number().optional()
|
|
4038
4044
|
}).optional().describe("Time configuration for notebook"),
|
|
4039
4045
|
status: z15.enum(["published"]).optional().describe("Notebook status"),
|
|
4040
|
-
pageSize: z15.number().optional().describe("Number of notebooks to return"),
|
|
4046
|
+
pageSize: z15.number().min(1).optional().describe("Number of notebooks to return"),
|
|
4041
4047
|
pageNumber: z15.number().optional().describe("Page number for pagination")
|
|
4042
4048
|
};
|
|
4043
4049
|
function formatNotebookSummary(nb) {
|
|
@@ -4092,8 +4098,8 @@ async function listNotebooks(api, params, limits) {
|
|
|
4092
4098
|
authorHandle: params.authorHandle,
|
|
4093
4099
|
excludeAuthorHandle: params.excludeAuthorHandle,
|
|
4094
4100
|
includeCells: params.includeCells ?? false,
|
|
4095
|
-
count:
|
|
4096
|
-
start: (params.pageNumber ?? 0) * (params.pageSize ?? limits.
|
|
4101
|
+
count: params.pageSize ?? limits.defaultLimit,
|
|
4102
|
+
start: (params.pageNumber ?? 0) * (params.pageSize ?? limits.defaultLimit)
|
|
4097
4103
|
});
|
|
4098
4104
|
const notebooks = (response.data ?? []).map(formatNotebookSummary);
|
|
4099
4105
|
return {
|
|
@@ -4310,7 +4316,7 @@ var InputSchema15 = {
|
|
|
4310
4316
|
id: z16.string().optional().describe("User ID (required for get action)"),
|
|
4311
4317
|
filter: z16.string().optional().describe("Filter users by name or email"),
|
|
4312
4318
|
status: z16.enum(["Active", "Pending", "Disabled"]).optional().describe("Filter by user status"),
|
|
4313
|
-
pageSize: z16.number().optional().describe("Number of users to return per page"),
|
|
4319
|
+
pageSize: z16.number().min(1).optional().describe("Number of users to return per page"),
|
|
4314
4320
|
pageNumber: z16.number().optional().describe("Page number for pagination")
|
|
4315
4321
|
};
|
|
4316
4322
|
function formatUser(user) {
|
|
@@ -4338,7 +4344,7 @@ async function listUsers(api, params, limits) {
|
|
|
4338
4344
|
const response = await api.listUsers({
|
|
4339
4345
|
filter: params.filter,
|
|
4340
4346
|
filterStatus: params.status,
|
|
4341
|
-
pageSize:
|
|
4347
|
+
pageSize: params.pageSize ?? limits.defaultLimit,
|
|
4342
4348
|
pageNumber: params.pageNumber ?? 0
|
|
4343
4349
|
});
|
|
4344
4350
|
const users = (response.data ?? []).map(formatUser);
|
|
@@ -4392,7 +4398,7 @@ var InputSchema16 = {
|
|
|
4392
4398
|
action: ActionSchema16.describe("Action to perform"),
|
|
4393
4399
|
id: z17.string().optional().describe("Team ID (required for get/members actions)"),
|
|
4394
4400
|
filter: z17.string().optional().describe("Filter teams by name"),
|
|
4395
|
-
pageSize: z17.number().optional().describe("Number of teams to return per page"),
|
|
4401
|
+
pageSize: z17.number().min(1).optional().describe("Number of teams to return per page"),
|
|
4396
4402
|
pageNumber: z17.number().optional().describe("Page number for pagination")
|
|
4397
4403
|
};
|
|
4398
4404
|
function formatTeam(team) {
|
|
@@ -4426,7 +4432,7 @@ function formatTeamMember(member) {
|
|
|
4426
4432
|
async function listTeams(api, params, limits) {
|
|
4427
4433
|
const response = await api.listTeams({
|
|
4428
4434
|
filterKeyword: params.filter,
|
|
4429
|
-
pageSize:
|
|
4435
|
+
pageSize: params.pageSize ?? limits.defaultLimit,
|
|
4430
4436
|
pageNumber: params.pageNumber ?? 0
|
|
4431
4437
|
});
|
|
4432
4438
|
const teams = (response.data ?? []).map(formatTeam);
|
|
@@ -4449,7 +4455,7 @@ async function getTeam(api, teamId) {
|
|
|
4449
4455
|
async function getTeamMembers(api, teamId, limits) {
|
|
4450
4456
|
const response = await api.getTeamMemberships({
|
|
4451
4457
|
teamId,
|
|
4452
|
-
pageSize: limits.
|
|
4458
|
+
pageSize: limits.defaultLimit
|
|
4453
4459
|
});
|
|
4454
4460
|
const members = (response.data ?? []).map(formatTeamMember);
|
|
4455
4461
|
return {
|