Skip to content

stack_diagnose

Diagnose a stack by stable ID in one read-only call. Correlate service health, updates, alerts and bounded filtered logs; report healthy, unhealthy or inconclusive and retain evidence with source gaps.

Availability

Available under the default capability policy

The instance’s tool selection and upstream Core permissions also apply. Some inputs require additional grants.

Effect annotations

  • readOnlyHint — true
  • destructiveHint — false
  • idempotentHint — true

Inputs

The registered schema gives field types, alternatives and declared bounds. The description and operator guides also cover checks applied at runtime.

id
Stable Stack ID returned by inventory or fleet_health. Required · type "string" · pattern "^[0-9a-fA-F]{24}$"
Show input JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "Stable Stack ID returned by inventory or fleet_health.",
      "pattern": "^[0-9a-fA-F]{24}$",
      "type": "string"
    }
  },
  "required": [
    "id"
  ],
  "type": "object"
}

Output

The registered output schema covers structured results and tool errors.

StackDiagnosis
affected_services, failed_update, gaps, limits, logs, outcome, recent_alerts, recent_updates, services, stack, stack_id, summary
AppError
candidates, correction, field, kind, message, operation, status
Show output JSON Schema
{
  "type": "object",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "anyOf": [
    {
      "$ref": "#/$defs/StackDiagnosis"
    },
    {
      "$ref": "#/$defs/AppError"
    }
  ],
  "$defs": {
    "ActionObservation": {
      "properties": {
        "cancellation_reported": {
          "type": "boolean"
        },
        "command_stage_found": {
          "type": "boolean"
        },
        "command_success": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "evidence_limit": {
          "type": "string"
        },
        "output_omitted": {
          "type": "boolean"
        },
        "stderr_present": {
          "type": "boolean"
        },
        "stdout_present": {
          "type": "boolean"
        }
      },
      "required": [
        "command_stage_found",
        "command_success",
        "stdout_present",
        "stderr_present",
        "cancellation_reported",
        "output_omitted",
        "evidence_limit"
      ],
      "type": "object"
    },
    "AlertSummary": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "level": {
          "type": "string"
        },
        "resolved": {
          "type": "boolean"
        },
        "resolved_ts": {
          "format": "int64",
          "type": [
            "integer",
            "null"
          ]
        },
        "target": {
          "$ref": "#/$defs/HistoryTarget"
        },
        "ts": {
          "description": "Unix milliseconds.",
          "format": "int64",
          "type": "integer"
        },
        "variant": {
          "description": "Alert variant only; raw variant payloads, messages and error chains are omitted.",
          "type": "string"
        }
      },
      "required": [
        "id",
        "ts",
        "resolved",
        "resolved_ts",
        "level",
        "target",
        "variant"
      ],
      "type": "object"
    },
    "AppError": {
      "additionalProperties": false,
      "description": "Only application-owned messages and selected, nonsensitive metadata survive.",
      "properties": {
        "candidates": {
          "items": {
            "$ref": "#/$defs/Candidate"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "correction": {
          "type": [
            "string",
            "null"
          ]
        },
        "field": {
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "$ref": "#/$defs/ErrorKind"
        },
        "message": {
          "type": "string"
        },
        "operation": {
          "type": "string"
        },
        "status": {
          "format": "uint16",
          "maximum": 65535,
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "kind",
        "message",
        "operation"
      ],
      "type": "object"
    },
    "BuildObservation": {
      "properties": {
        "deployment_result_evidence": {
          "type": "string"
        },
        "evidence_limit": {
          "type": "string"
        },
        "image_evidence_ambiguous": {
          "type": "boolean"
        },
        "image_evidence_incomplete": {
          "type": "boolean"
        },
        "images": {
          "items": {
            "$ref": "#/$defs/ImageObservation"
          },
          "type": "array"
        },
        "registry_push_failure_reported": {
          "type": "boolean"
        },
        "version": {
          "type": [
            "string",
            "null"
          ]
        },
        "version_evidence": {
          "type": "string"
        }
      },
      "required": [
        "version",
        "version_evidence",
        "images",
        "image_evidence_incomplete",
        "image_evidence_ambiguous",
        "registry_push_failure_reported",
        "deployment_result_evidence",
        "evidence_limit"
      ],
      "type": "object"
    },
    "Candidate": {
      "additionalProperties": false,
      "description": "A bounded ambiguity hint, never a raw upstream resource.",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "type": "object"
    },
    "DeploymentTarget": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "kind": {
          "$ref": "#/$defs/TargetKind"
        },
        "name": {
          "description": "Null if Core did not supply a display name. The ID remains usable.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "kind",
        "id",
        "name"
      ],
      "type": "object"
    },
    "DiagnosisLimits": {
      "additionalProperties": false,
      "properties": {
        "evidence_truncated": {
          "type": "boolean"
        },
        "max_core_calls": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "max_output_bytes": {
          "description": "Serialized structured-report JSON bytes; text content and MCP framing add overhead.",
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "max_parallel_core_calls": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "max_source_response_bytes": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "max_wait_ms": {
          "description": "Two bounded waves; includes inventory resolution in its first deadline.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "source_timeout_ms": {
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "max_core_calls",
        "max_parallel_core_calls",
        "source_timeout_ms",
        "max_wait_ms",
        "max_output_bytes",
        "max_source_response_bytes",
        "evidence_truncated"
      ],
      "type": "object"
    },
    "DiagnosisOutcome": {
      "enum": [
        "unhealthy",
        "healthy",
        "inconclusive"
      ],
      "type": "string"
    },
    "ErrorKind": {
      "description": "Stable public categories. No variant contains a raw upstream error.",
      "enum": [
        "invalid_arguments",
        "not_found",
        "ambiguous_target",
        "incomplete_resolution",
        "configuration",
        "authentication",
        "permission_denied",
        "timeout",
        "unreachable",
        "upstream",
        "invalid_response",
        "response_too_large",
        "capability_disabled",
        "unsupported_target",
        "stale_preview",
        "invalid_preview"
      ],
      "type": "string"
    },
    "EvidenceGap": {
      "additionalProperties": false,
      "properties": {
        "error": {
          "$ref": "#/$defs/AppError"
        },
        "source": {
          "type": "string"
        }
      },
      "required": [
        "source",
        "error"
      ],
      "type": "object"
    },
    "ExecutionEvent": {
      "properties": {
        "event": {
          "type": "string"
        },
        "operation": {
          "type": "string"
        },
        "stage_event_index": {
          "format": "uint",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "terminal_success": {
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "required": [
        "operation",
        "event",
        "stage_event_index",
        "terminal_success"
      ],
      "type": "object"
    },
    "HealthStatus": {
      "enum": [
        "healthy",
        "unhealthy",
        "unavailable",
        "unknown"
      ],
      "type": "string"
    },
    "HistoryTarget": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "Stable resource ID; System uses its literal system identifier.",
          "type": "string"
        },
        "kind": {
          "$ref": "#/$defs/ResourceKind"
        }
      },
      "required": [
        "kind",
        "id"
      ],
      "type": "object"
    },
    "ImageEventKind": {
      "enum": [
        "tagged",
        "manifest_push_reported"
      ],
      "type": "string"
    },
    "ImageObservation": {
      "properties": {
        "digest": {
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "$ref": "#/$defs/ImageEventKind"
        },
        "reference": {
          "type": "string"
        },
        "stage_index": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "stage_success": {
          "type": "boolean"
        }
      },
      "required": [
        "reference",
        "digest",
        "kind",
        "stage_index",
        "stage_success"
      ],
      "type": "object"
    },
    "LogTarget": {
      "additionalProperties": false,
      "properties": {
        "container": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "description": "Server ID for a container, otherwise the workload's stable ID.",
          "type": "string"
        },
        "kind": {
          "$ref": "#/$defs/LogTargetKind"
        },
        "services": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "kind",
        "id",
        "container",
        "services"
      ],
      "type": "object"
    },
    "LogTargetKind": {
      "enum": [
        "container",
        "deployment",
        "stack",
        "swarm_service"
      ],
      "type": "string"
    },
    "LogTruncation": {
      "additionalProperties": false,
      "properties": {
        "bytes": {
          "description": "Redacted selected lines exceeded the joint UTF-8 byte budget.",
          "type": "boolean"
        },
        "lines": {
          "description": "More than the requested joint line limit was returned by Core.",
          "type": "boolean"
        },
        "upstream_may_have_more": {
          "description": "Core provides no complete-log count. A full tail may omit earlier logs.",
          "type": "boolean"
        }
      },
      "required": [
        "lines",
        "bytes",
        "upstream_may_have_more"
      ],
      "type": "object"
    },
    "ProcedureObservation": {
      "properties": {
        "cancellation_reported": {
          "type": "boolean"
        },
        "child_results_complete": {
          "type": "boolean"
        },
        "evidence_ambiguous": {
          "type": "boolean"
        },
        "evidence_incomplete": {
          "type": "boolean"
        },
        "evidence_limit": {
          "type": "string"
        },
        "executions": {
          "items": {
            "$ref": "#/$defs/ExecutionEvent"
          },
          "type": "array"
        },
        "failed_stage_reported": {
          "type": [
            "string",
            "null"
          ]
        },
        "permission_denial_reported": {
          "type": "boolean"
        },
        "reported_child_update_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "stages": {
          "items": {
            "$ref": "#/$defs/StageEvent"
          },
          "type": "array"
        }
      },
      "required": [
        "stages",
        "executions",
        "reported_child_update_ids",
        "evidence_incomplete",
        "evidence_ambiguous",
        "cancellation_reported",
        "permission_denial_reported",
        "failed_stage_reported",
        "child_results_complete",
        "evidence_limit"
      ],
      "type": "object"
    },
    "ResourceKind": {
      "enum": [
        "system",
        "swarm",
        "server",
        "stack",
        "deployment",
        "build",
        "repo",
        "procedure",
        "action",
        "builder",
        "alerter",
        "resource_sync"
      ],
      "type": "string"
    },
    "RevisionObservation": {
      "properties": {
        "evidence": {
          "description": "update_commit_hash or the pinned Repo Latest Commit stage. Never inferred\nfrom a configured branch or the resource's mutable current cache.",
          "type": "string"
        },
        "revision": {
          "type": "string"
        }
      },
      "required": [
        "revision",
        "evidence"
      ],
      "type": "object"
    },
    "ServiceHealth": {
      "additionalProperties": false,
      "properties": {
        "container_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "container_status": {
          "type": [
            "string",
            "null"
          ]
        },
        "health": {
          "$ref": "#/$defs/HealthStatus"
        },
        "service": {
          "type": "string"
        },
        "state": {
          "type": "string"
        }
      },
      "required": [
        "service",
        "state",
        "health",
        "container_name",
        "container_status"
      ],
      "type": "object"
    },
    "StackDetail": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "project_name": {
          "description": "Deployed project name, then configured project name, then resource name.",
          "type": [
            "string",
            "null"
          ]
        },
        "service_count": {
          "description": "Count of services reported by Core, not a count of running containers.",
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "state": {
          "$ref": "#/$defs/StackState"
        },
        "target": {
          "anyOf": [
            {
              "$ref": "#/$defs/DeploymentTarget"
            },
            {
              "type": "null"
            }
          ]
        },
        "template": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "name",
        "template",
        "state",
        "target",
        "service_count",
        "project_name"
      ],
      "type": "object"
    },
    "StackDiagnosis": {
      "additionalProperties": false,
      "properties": {
        "affected_services": {
          "description": "At most four affected service names; services retains further evidence.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "failed_update": {
          "anyOf": [
            {
              "$ref": "#/$defs/UpdateDetail"
            },
            {
              "type": "null"
            }
          ]
        },
        "gaps": {
          "items": {
            "$ref": "#/$defs/EvidenceGap"
          },
          "type": "array"
        },
        "limits": {
          "$ref": "#/$defs/DiagnosisLimits"
        },
        "logs": {
          "anyOf": [
            {
              "$ref": "#/$defs/WorkloadLogs"
            },
            {
              "type": "null"
            }
          ]
        },
        "outcome": {
          "$ref": "#/$defs/DiagnosisOutcome"
        },
        "recent_alerts": {
          "items": {
            "$ref": "#/$defs/AlertSummary"
          },
          "type": "array"
        },
        "recent_updates": {
          "items": {
            "$ref": "#/$defs/UpdateSummary"
          },
          "type": "array"
        },
        "services": {
          "anyOf": [
            {
              "$ref": "#/$defs/StackServices"
            },
            {
              "type": "null"
            }
          ]
        },
        "stack": {
          "anyOf": [
            {
              "$ref": "#/$defs/StackDetail"
            },
            {
              "type": "null"
            }
          ]
        },
        "stack_id": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        }
      },
      "required": [
        "stack_id",
        "stack",
        "outcome",
        "summary",
        "affected_services",
        "services",
        "recent_updates",
        "recent_alerts",
        "failed_update",
        "logs",
        "gaps",
        "limits"
      ],
      "type": "object"
    },
    "StackServices": {
      "additionalProperties": false,
      "properties": {
        "services": {
          "items": {
            "$ref": "#/$defs/ServiceHealth"
          },
          "type": "array"
        },
        "stack_id": {
          "type": "string"
        },
        "truncated": {
          "description": "At least one service was omitted. A truncated healthy set is inconclusive.",
          "type": "boolean"
        }
      },
      "required": [
        "stack_id",
        "services",
        "truncated"
      ],
      "type": "object"
    },
    "StackState": {
      "enum": [
        "deploying",
        "running",
        "paused",
        "stopped",
        "created",
        "restarting",
        "dead",
        "removing",
        "unhealthy",
        "down",
        "unknown"
      ],
      "type": "string"
    },
    "StageEvent": {
      "properties": {
        "event": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "event"
      ],
      "type": "object"
    },
    "SyncBatchReport": {
      "properties": {
        "phase": {
          "type": "string"
        },
        "stage": {
          "type": "string"
        },
        "success_reported": {
          "type": "boolean"
        }
      },
      "required": [
        "stage",
        "phase",
        "success_reported"
      ],
      "type": "object"
    },
    "SyncObservation": {
      "properties": {
        "batches": {
          "items": {
            "$ref": "#/$defs/SyncBatchReport"
          },
          "type": "array"
        },
        "child_deployment_success_verified": {
          "type": "boolean"
        },
        "deployment_batches_failed": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "evidence_incomplete": {
          "type": "boolean"
        },
        "evidence_limit": {
          "type": "string"
        },
        "no_changes_reported": {
          "type": "boolean"
        },
        "partial_changes_possible": {
          "type": "boolean"
        },
        "raw_output_omitted": {
          "type": "boolean"
        },
        "resource_batches_failed": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "workload_health_verified": {
          "type": "boolean"
        }
      },
      "required": [
        "batches",
        "resource_batches_failed",
        "deployment_batches_failed",
        "no_changes_reported",
        "evidence_incomplete",
        "raw_output_omitted",
        "partial_changes_possible",
        "child_deployment_success_verified",
        "workload_health_verified",
        "evidence_limit"
      ],
      "type": "object"
    },
    "TargetKind": {
      "enum": [
        "server",
        "swarm"
      ],
      "type": "string"
    },
    "TestObservation": {
      "properties": {
        "core_report": {
          "type": "string"
        },
        "evidence_limit": {
          "type": "string"
        },
        "independently_observed_receipt": {
          "type": "string"
        },
        "provider_attempt": {
          "type": "string"
        }
      },
      "required": [
        "core_report",
        "provider_attempt",
        "independently_observed_receipt",
        "evidence_limit"
      ],
      "type": "object"
    },
    "UpdateDetail": {
      "additionalProperties": false,
      "properties": {
        "end_ts": {
          "format": "int64",
          "type": [
            "integer",
            "null"
          ]
        },
        "id": {
          "type": "string"
        },
        "observed_action_result": {
          "anyOf": [
            {
              "$ref": "#/$defs/ActionObservation"
            },
            {
              "type": "null"
            }
          ]
        },
        "observed_alerter_test": {
          "anyOf": [
            {
              "$ref": "#/$defs/TestObservation"
            },
            {
              "type": "null"
            }
          ]
        },
        "observed_build_result": {
          "anyOf": [
            {
              "$ref": "#/$defs/BuildObservation"
            },
            {
              "type": "null"
            }
          ]
        },
        "observed_procedure_result": {
          "anyOf": [
            {
              "$ref": "#/$defs/ProcedureObservation"
            },
            {
              "type": "null"
            }
          ]
        },
        "observed_revision": {
          "anyOf": [
            {
              "$ref": "#/$defs/RevisionObservation"
            },
            {
              "type": "null"
            }
          ]
        },
        "observed_sync_result": {
          "anyOf": [
            {
              "$ref": "#/$defs/SyncObservation"
            },
            {
              "type": "null"
            }
          ]
        },
        "operation": {
          "type": "string"
        },
        "outcome": {
          "$ref": "#/$defs/UpdateOutcome"
        },
        "stages": {
          "description": "At most 20 stages, failures first, preserving original index/order within each group.",
          "items": {
            "$ref": "#/$defs/UpdateStage"
          },
          "type": "array"
        },
        "stages_truncated": {
          "type": "boolean"
        },
        "start_ts": {
          "description": "Unix milliseconds.",
          "format": "int64",
          "type": "integer"
        },
        "status": {
          "$ref": "#/$defs/UpdateStatus"
        },
        "target": {
          "$ref": "#/$defs/HistoryTarget"
        }
      },
      "required": [
        "id",
        "operation",
        "start_ts",
        "target",
        "status",
        "outcome",
        "end_ts",
        "stages",
        "stages_truncated"
      ],
      "type": "object"
    },
    "UpdateOutcome": {
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed"
      ],
      "type": "string"
    },
    "UpdateStage": {
      "additionalProperties": false,
      "properties": {
        "end_ts": {
          "format": "int64",
          "type": "integer"
        },
        "index": {
          "description": "Original zero-based index, even when failed stages are prioritized.",
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "stage": {
          "type": "string"
        },
        "stage_truncated": {
          "type": "boolean"
        },
        "start_ts": {
          "format": "int64",
          "type": "integer"
        },
        "stderr": {
          "description": "Bounded redacted stderr only; command and stdout are never returned.",
          "type": "string"
        },
        "stderr_truncated": {
          "type": "boolean"
        },
        "success": {
          "type": "boolean"
        }
      },
      "required": [
        "index",
        "stage",
        "stage_truncated",
        "success",
        "start_ts",
        "end_ts",
        "stderr",
        "stderr_truncated"
      ],
      "type": "object"
    },
    "UpdateStatus": {
      "enum": [
        "queued",
        "running",
        "complete"
      ],
      "type": "string"
    },
    "UpdateSummary": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "operation": {
          "type": "string"
        },
        "outcome": {
          "$ref": "#/$defs/UpdateOutcome"
        },
        "start_ts": {
          "description": "Unix milliseconds.",
          "format": "int64",
          "type": "integer"
        },
        "status": {
          "$ref": "#/$defs/UpdateStatus"
        },
        "target": {
          "$ref": "#/$defs/HistoryTarget"
        }
      },
      "required": [
        "id",
        "operation",
        "start_ts",
        "target",
        "status",
        "outcome"
      ],
      "type": "object"
    },
    "WorkloadLogs": {
      "additionalProperties": false,
      "properties": {
        "end_ts": {
          "format": "int64",
          "type": "integer"
        },
        "max_bytes": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "requested_tail": {
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "returned_bytes": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "returned_lines": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "start_ts": {
          "format": "int64",
          "type": "integer"
        },
        "stderr": {
          "type": "string"
        },
        "stdout": {
          "type": "string"
        },
        "target": {
          "$ref": "#/$defs/LogTarget"
        },
        "timestamps": {
          "type": "boolean"
        },
        "truncation": {
          "$ref": "#/$defs/LogTruncation"
        }
      },
      "required": [
        "target",
        "requested_tail",
        "max_bytes",
        "timestamps",
        "stdout",
        "stderr",
        "returned_lines",
        "returned_bytes",
        "truncation",
        "start_ts",
        "end_ts"
      ],
      "type": "object"
    }
  }
}

Operator guides

All built-in tools