Skip to content

get_stack_logs

Read a bounded Stack log tail by stable ID and exact service filters (Compose: optional; Swarm: pass one). Tail 1..500 and max_bytes 1..65536 apply jointly after redaction; includes truncation metadata.

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. Required · type "string" · pattern "^[0-9a-fA-F]{24}$"
max_bytes
type "integer" · minimum 1 · maximum 65536 · default 16384
services
Exact services; at most 16. Compose: empty includes all. Swarm: pass one. type "array" · maxItems 16 · default []
tail
type "integer" · minimum 1 · maximum 500 · default 100
timestamps
type "boolean" · default false
Show input JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "Stable Stack ID returned by inventory.",
      "pattern": "^[0-9a-fA-F]{24}$",
      "type": "string"
    },
    "max_bytes": {
      "default": 16384,
      "format": "uint",
      "maximum": 65536,
      "minimum": 1,
      "type": "integer"
    },
    "services": {
      "default": [],
      "description": "Exact services; at most 16. Compose: empty includes all. Swarm: pass one.",
      "items": {
        "type": "string"
      },
      "maxItems": 16,
      "type": "array"
    },
    "tail": {
      "default": 100,
      "format": "uint64",
      "maximum": 500,
      "minimum": 1,
      "type": "integer"
    },
    "timestamps": {
      "default": false,
      "type": "boolean"
    }
  },
  "required": [
    "id"
  ],
  "type": "object"
}

Output

The registered output schema covers structured results and tool errors.

WorkloadLogs
end_ts, max_bytes, requested_tail, returned_bytes, returned_lines, start_ts, stderr, stdout, target, timestamps, truncation
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/WorkloadLogs"
    },
    {
      "$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"
    },
    "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"
    },
    "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"
    },
    "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