datadog-mcp 1.0.9 → 1.0.11

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 CHANGED
@@ -384,7 +384,9 @@ var InputSchema = {
384
384
  query: z2.string().optional().describe("Search query (for search action)"),
385
385
  name: z2.string().optional().describe("Filter by name (for list action)"),
386
386
  tags: z2.array(z2.string()).optional().describe("Filter by tags"),
387
- groupStates: z2.array(z2.string()).optional().describe("Filter by group states: alert, warn, no data, ok"),
387
+ groupStates: z2.array(z2.string()).optional().describe(
388
+ "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"
389
+ ),
388
390
  limit: z2.number().optional().describe("Maximum number of monitors to return"),
389
391
  config: z2.record(z2.unknown()).optional().describe("Monitor configuration (for create/update)"),
390
392
  message: z2.string().optional().describe("Mute message (for mute action)"),
@@ -905,7 +907,7 @@ var InputSchema3 = {
905
907
  "Sampling mode: first (chronological, default), spread (evenly across time range), diverse (distinct message patterns)"
906
908
  ),
907
909
  compact: z4.boolean().optional().describe(
908
- "Strip custom attributes for token efficiency. Keeps: id, timestamp, service, status, message (truncated), dd.trace_id, error info"
910
+ "Strip custom attributes for token efficiency. Keeps: id, timestamp, service, host, status, message (truncated), dd.trace_id, dd.span_id, pod_name, kube_namespace, kube_container_name, error info"
909
911
  ),
910
912
  groupBy: z4.array(z4.string()).optional().describe("Fields to group by (for aggregate)"),
911
913
  compute: z4.record(z4.unknown()).optional().describe("Compute operations (for aggregate)")
@@ -931,6 +933,14 @@ function formatLog(log) {
931
933
  function formatLogCompact(log) {
932
934
  const attrs = log.attributes ?? {};
933
935
  const nestedAttrs = attrs.attributes ?? {};
936
+ const tags = attrs.tags ?? [];
937
+ const findTagValue = (tagPrefix) => {
938
+ const tag = tags.find((t) => t.startsWith(tagPrefix + ":"));
939
+ return tag ? tag.substring(tagPrefix.length + 1) : "";
940
+ };
941
+ const podName = findTagValue("pod_name");
942
+ const namespace = findTagValue("kube_namespace");
943
+ const container = findTagValue("kube_container_name");
934
944
  let timestamp = "";
935
945
  if (attrs.timestamp) {
936
946
  const ts = attrs.timestamp;
@@ -953,6 +963,9 @@ function formatLogCompact(log) {
953
963
  traceId,
954
964
  spanId
955
965
  };
966
+ if (podName) entry.podName = podName;
967
+ if (namespace) entry.namespace = namespace;
968
+ if (container) entry.container = container;
956
969
  if (errorType || errorMessage) {
957
970
  entry.error = {
958
971
  type: errorType,
@@ -1384,6 +1397,8 @@ function formatSpan(span) {
1384
1397
  const tags = attrs.tags ?? [];
1385
1398
  const nestedAttrs = attrs.attributes ?? {};
1386
1399
  const custom = attrs.custom ?? {};
1400
+ const attrsError = attrs.error ?? {};
1401
+ const customError = custom.error ?? {};
1387
1402
  const tagMap = {};
1388
1403
  for (const tag of tags) {
1389
1404
  const [key, value] = tag.split(":");
@@ -1399,13 +1414,13 @@ function formatSpan(span) {
1399
1414
  } else if (typeof custom["duration"] === "number") {
1400
1415
  durationNs = custom["duration"];
1401
1416
  }
1402
- const status = nestedAttrs["status"] ?? custom["status"] ?? tagMap["status"] ?? "";
1417
+ const status = attrs.status ?? custom["status"] ?? tagMap["status"] ?? "";
1403
1418
  return {
1404
1419
  traceId: attrs.traceId ?? "",
1405
1420
  spanId: attrs.spanId ?? "",
1406
1421
  service: attrs.service ?? "",
1407
1422
  resource: attrs.resourceName ?? "",
1408
- operation: nestedAttrs["operation_name"] ?? custom["operation_name"] ?? "",
1423
+ operation: attrs.operationName ?? custom["operation_name"] ?? "",
1409
1424
  type: attrs.type ?? "",
1410
1425
  status,
1411
1426
  duration: formatDurationNs(durationNs),
@@ -1416,8 +1431,8 @@ function formatSpan(span) {
1416
1431
  url: tagMap["http.url"] ?? ""
1417
1432
  },
1418
1433
  error: {
1419
- type: tagMap["error.type"] ?? "",
1420
- message: tagMap["error.message"] ?? tagMap["error.msg"] ?? ""
1434
+ type: attrsError["type"] ?? customError["type"] ?? tagMap["error.type"] ?? "",
1435
+ message: customError["message"] ?? tagMap["error.message"] ?? tagMap["error.msg"] ?? ""
1421
1436
  },
1422
1437
  env: attrs.env ?? tagMap["env"] ?? "",
1423
1438
  tags
@@ -1615,7 +1630,7 @@ async function listApmServices(api, params, limits) {
1615
1630
  const buckets = response.data ?? [];
1616
1631
  const services = buckets.map((bucket) => ({
1617
1632
  name: bucket.attributes?.by?.["service"] ?? "",
1618
- spanCount: bucket.attributes?.computes?.["c0"] ?? 0
1633
+ spanCount: bucket.attributes?.compute?.["c0"] ?? 0
1619
1634
  })).filter((s) => s.name !== "");
1620
1635
  return {
1621
1636
  services,