datadog-mcp 5.3.1 → 5.3.2
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/dist/index.js +51 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3197,27 +3197,69 @@ function formatSlo(s) {
|
|
|
3197
3197
|
timeframe: String(primaryThreshold?.timeframe ?? ""),
|
|
3198
3198
|
tags: s.tags ?? [],
|
|
3199
3199
|
status: {
|
|
3200
|
-
// Note: SLI status requires a separate API call to getSLOHistory
|
|
3201
3200
|
sli: null,
|
|
3202
3201
|
errorBudgetRemaining: null,
|
|
3203
3202
|
state: "unknown"
|
|
3204
3203
|
},
|
|
3204
|
+
overallStatus: [],
|
|
3205
3205
|
createdAt: s.createdAt ? new Date(s.createdAt * 1e3).toISOString() : "",
|
|
3206
3206
|
modifiedAt: s.modifiedAt ? new Date(s.modifiedAt * 1e3).toISOString() : ""
|
|
3207
3207
|
};
|
|
3208
3208
|
}
|
|
3209
|
+
function formatSearchSlo(slo) {
|
|
3210
|
+
const attrs = slo.data?.attributes;
|
|
3211
|
+
const primaryThreshold = attrs?.thresholds?.[0];
|
|
3212
|
+
return {
|
|
3213
|
+
id: slo.data?.id ?? "",
|
|
3214
|
+
name: attrs?.name ?? "",
|
|
3215
|
+
description: attrs?.description ?? null,
|
|
3216
|
+
type: String(attrs?.sloType ?? "unknown"),
|
|
3217
|
+
targetThreshold: primaryThreshold?.target ?? 0,
|
|
3218
|
+
warningThreshold: primaryThreshold?.warning ?? null,
|
|
3219
|
+
timeframe: String(primaryThreshold?.timeframe ?? ""),
|
|
3220
|
+
tags: attrs?.allTags ?? [],
|
|
3221
|
+
status: {
|
|
3222
|
+
sli: attrs?.status?.sli ?? null,
|
|
3223
|
+
errorBudgetRemaining: attrs?.status?.errorBudgetRemaining ?? null,
|
|
3224
|
+
state: String(attrs?.status?.state ?? "unknown")
|
|
3225
|
+
},
|
|
3226
|
+
overallStatus: (attrs?.overallStatus ?? []).map((os) => ({
|
|
3227
|
+
sli: os.status ?? null,
|
|
3228
|
+
errorBudgetRemaining: os.errorBudgetRemaining ?? null,
|
|
3229
|
+
state: String(os.state ?? "unknown"),
|
|
3230
|
+
target: os.target ?? null,
|
|
3231
|
+
timeframe: String(os.timeframe ?? "")
|
|
3232
|
+
})),
|
|
3233
|
+
createdAt: attrs?.createdAt ? new Date(attrs.createdAt * 1e3).toISOString() : "",
|
|
3234
|
+
modifiedAt: attrs?.modifiedAt ? new Date(attrs.modifiedAt * 1e3).toISOString() : ""
|
|
3235
|
+
};
|
|
3236
|
+
}
|
|
3237
|
+
function buildSearchQuery(query, tags) {
|
|
3238
|
+
const parts = [];
|
|
3239
|
+
if (query) parts.push(query);
|
|
3240
|
+
if (tags?.length) parts.push(...tags);
|
|
3241
|
+
return parts.join(" ");
|
|
3242
|
+
}
|
|
3209
3243
|
async function listSlos(api, params, limits) {
|
|
3210
3244
|
const effectiveLimit = params.limit ?? limits.defaultLimit;
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3245
|
+
if (params.ids?.length) {
|
|
3246
|
+
const response2 = await api.listSLOs({
|
|
3247
|
+
ids: params.ids.join(","),
|
|
3248
|
+
limit: effectiveLimit
|
|
3249
|
+
});
|
|
3250
|
+
const slos3 = (response2.data ?? []).map(formatSlo);
|
|
3251
|
+
return { slos: slos3, total: slos3.length };
|
|
3252
|
+
}
|
|
3253
|
+
const searchQuery = buildSearchQuery(params.query, params.tags);
|
|
3254
|
+
const response = await api.searchSLO({
|
|
3255
|
+
query: searchQuery || void 0,
|
|
3256
|
+
pageSize: effectiveLimit
|
|
3216
3257
|
});
|
|
3217
|
-
const
|
|
3258
|
+
const searchSlos = response.data?.attributes?.slos ?? [];
|
|
3259
|
+
const slos2 = searchSlos.map(formatSearchSlo);
|
|
3218
3260
|
return {
|
|
3219
3261
|
slos: slos2,
|
|
3220
|
-
total:
|
|
3262
|
+
total: slos2.length
|
|
3221
3263
|
};
|
|
3222
3264
|
}
|
|
3223
3265
|
async function getSlo(api, id) {
|
|
@@ -3309,7 +3351,7 @@ async function getSloHistory(api, id, params) {
|
|
|
3309
3351
|
function registerSlosTool(server, api, limits, readOnly = false, _site = "datadoghq.com") {
|
|
3310
3352
|
server.tool(
|
|
3311
3353
|
"slos",
|
|
3312
|
-
"Manage Datadog Service Level Objectives. Actions: list, get, create, update, delete, history. SLO types: metric-based, monitor-based. Use for: reliability tracking, error budgets, SLA compliance, performance targets.",
|
|
3354
|
+
"Manage Datadog Service Level Objectives. Actions: list (with SLI status & error budget), get, create, update, delete, history. SLO types: metric-based, monitor-based. Use for: reliability tracking, error budgets, SLA compliance, performance targets.",
|
|
3313
3355
|
InputSchema8,
|
|
3314
3356
|
async ({ action, id, ids, query, tags, limit, config, from, to }) => {
|
|
3315
3357
|
try {
|