Skip to content

diagnose_swarm_service

Diagnose one exact Swarm service using fresh inspect plus explicitly cached task/node discovery. Core Read + Inspect required. Trace pending/failed placement to up to eight fresh tasks and four related fresh nodes in 30 seconds; retain source gaps and incomplete coverage. Historical running tasks do not count as current replicas. Cache counts, fresh details, convergence and health remain separate. Zero mutations; raw Docker configuration/errors omitted.

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.

object
Required · Schema SwarmObjectSelector
target
Required · Schema DetailInput
Show input JSON Schema
{
  "type": "object",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "object": {
      "$ref": "#/$defs/SwarmObjectSelector"
    },
    "target": {
      "$ref": "#/$defs/DetailInput"
    }
  },
  "required": [
    "target",
    "object"
  ],
  "$defs": {
    "DetailInput": {
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "id"
          ]
        },
        {
          "required": [
            "name"
          ]
        }
      ],
      "properties": {
        "id": {
          "description": "Exact stable resource ID returned by a list tool.",
          "pattern": "^[0-9a-fA-F]{24}$",
          "type": "string"
        },
        "name": {
          "description": "Exact, case-sensitive name within this family; never interpreted as an ID.",
          "minLength": 1,
          "pattern": "\\S",
          "type": "string"
        }
      },
      "type": "object"
    },
    "SwarmObjectSelector": {
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "id"
          ]
        },
        {
          "required": [
            "name"
          ]
        }
      ],
      "properties": {
        "id": {
          "pattern": "^[a-z0-9]{25}$",
          "type": "string"
        },
        "name": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_.][a-zA-Z0-9_.-]*$",
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}

Output

The registered output schema covers structured results and tool errors.

Observation
data, evidence_limit, source, swarm
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/Observation"
    },
    {
      "$ref": "#/$defs/AppError"
    }
  ],
  "$defs": {
    "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"
    },
    "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"
    },
    "Diagnosis": {
      "properties": {
        "cached_current_running": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "cached_display_incomplete": {
          "type": "boolean"
        },
        "cached_nodes": {
          "items": {
            "$ref": "#/$defs/Node"
          },
          "type": "array"
        },
        "cached_pending": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "cached_service": {
          "$ref": "#/$defs/Service"
        },
        "cached_tasks": {
          "items": {
            "$ref": "#/$defs/Task"
          },
          "type": "array"
        },
        "cached_unclassified_tasks": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "evidence_limit": {
          "type": "string"
        },
        "fresh_node_coverage_incomplete": {
          "type": "boolean"
        },
        "fresh_nodes": {
          "items": {
            "$ref": "#/$defs/Node"
          },
          "type": "array"
        },
        "fresh_task_coverage_incomplete": {
          "type": "boolean"
        },
        "fresh_tasks": {
          "items": {
            "$ref": "#/$defs/Task"
          },
          "type": "array"
        },
        "gaps": {
          "items": {
            "$ref": "#/$defs/AppError"
          },
          "type": "array"
        },
        "historical_tasks": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "scan_incomplete": {
          "type": "boolean"
        },
        "service": {
          "$ref": "#/$defs/Service"
        },
        "under_replicated_in_cache": {
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "required": [
        "service",
        "cached_service",
        "cached_tasks",
        "fresh_tasks",
        "cached_nodes",
        "fresh_nodes",
        "cached_current_running",
        "cached_pending",
        "cached_unclassified_tasks",
        "historical_tasks",
        "under_replicated_in_cache",
        "scan_incomplete",
        "fresh_task_coverage_incomplete",
        "fresh_node_coverage_incomplete",
        "cached_display_incomplete",
        "gaps",
        "evidence_limit"
      ],
      "type": "object"
    },
    "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"
    },
    "Node": {
      "properties": {
        "availability": {
          "type": [
            "string",
            "null"
          ]
        },
        "hostname": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "type": "string"
        },
        "leader": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "reachability": {
          "type": [
            "string",
            "null"
          ]
        },
        "role": {
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "hostname",
        "role",
        "availability",
        "state",
        "leader",
        "reachability"
      ],
      "type": "object"
    },
    "Observation": {
      "properties": {
        "data": {
          "$ref": "#/$defs/Diagnosis"
        },
        "evidence_limit": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "swarm": {
          "$ref": "#/$defs/SwarmSummary"
        }
      },
      "required": [
        "swarm",
        "source",
        "evidence_limit",
        "data"
      ],
      "type": "object"
    },
    "Service": {
      "properties": {
        "desired_replicas": {
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "id": {
          "type": "string"
        },
        "mode": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "running_tasks": {
          "description": "Docker often supplies this only on the cached list, not fresh inspect.",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "state": {
          "type": "string"
        },
        "update_state": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "mode",
        "desired_replicas",
        "running_tasks",
        "state",
        "update_state"
      ],
      "type": "object"
    },
    "SwarmSummary": {
      "properties": {
        "id": {
          "type": "string"
        },
        "infrastructure_error_present": {
          "type": "boolean"
        },
        "manager_server_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "manager_servers_incomplete": {
          "type": "boolean"
        },
        "name": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "template": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "name",
        "template",
        "state",
        "manager_server_ids",
        "manager_servers_incomplete",
        "infrastructure_error_present"
      ],
      "type": "object"
    },
    "Task": {
      "properties": {
        "desired_state": {
          "type": [
            "string",
            "null"
          ]
        },
        "exit_code": {
          "format": "int64",
          "type": [
            "integer",
            "null"
          ]
        },
        "failure_reason": {
          "description": "Conservative application-owned classification; never raw Docker errors.",
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "node_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "replica_evidence": {
          "description": "current = desired running; historical = desired shutdown/remove;\nunknown = Core did not establish either. Not a healthy-replica count.",
          "type": "string"
        },
        "service_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "slot": {
          "format": "int64",
          "type": [
            "integer",
            "null"
          ]
        },
        "state": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "service_id",
        "node_id",
        "state",
        "desired_state",
        "replica_evidence",
        "slot",
        "exit_code",
        "failure_reason"
      ],
      "type": "object"
    }
  }
}

Operator guides

All built-in tools