Skip to content

get_container_logs

Read a bounded container log tail by stable Server ID and exact container name. Tail 1..500; combined stdout/stderr max_bytes 1..65536 after redaction, with 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.

container
Exact Docker container name or ID; at most 128 ASCII name characters. Required · type "string" · minLength 1 · maxLength 128
max_bytes
Joint stdout/stderr UTF-8 byte budget after redaction. type "integer" · minimum 1 · maximum 65536 · default 16384
server_id
Stable Server ID returned by inventory. Required · type "string" · pattern "^[0-9a-fA-F]{24}$"
tail
Positive upstream tail; also the joint stdout/stderr output line limit. 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": {
    "container": {
      "description": "Exact Docker container name or ID; at most 128 ASCII name characters.",
      "maxLength": 128,
      "minLength": 1,
      "type": "string"
    },
    "max_bytes": {
      "default": 16384,
      "description": "Joint stdout/stderr UTF-8 byte budget after redaction.",
      "format": "uint",
      "maximum": 65536,
      "minimum": 1,
      "type": "integer"
    },
    "server_id": {
      "description": "Stable Server ID returned by inventory.",
      "pattern": "^[0-9a-fA-F]{24}$",
      "type": "string"
    },
    "tail": {
      "default": 100,
      "description": "Positive upstream tail; also the joint stdout/stderr output line limit.",
      "format": "uint64",
      "maximum": 500,
      "minimum": 1,
      "type": "integer"
    },
    "timestamps": {
      "default": false,
      "type": "boolean"
    }
  },
  "required": [
    "server_id",
    "container"
  ],
  "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