Skip to content

get_swarm_service_logs

Read bounded fresh logs for one exact cached Swarm service ID or unique name. Core Read + Logs required, without requiring Inspect. Resolve once and send the full service ID, never all services. Tail 1–500, output 1–65536 bytes, existing redaction before clipping, details disabled. No mutation or selector fallback.

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.

max_bytes
type "integer" · minimum 1 · maximum 65536 · default 16384
service
Required · Schema SwarmObjectSelector
tail
type "integer" · minimum 1 · maximum 500 · default 100
target
Required · Schema DetailInput
timestamps
type "boolean" · default false
Show input JSON Schema
{
  "type": "object",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "max_bytes": {
      "default": 16384,
      "format": "uint",
      "maximum": 65536,
      "minimum": 1,
      "type": "integer"
    },
    "service": {
      "$ref": "#/$defs/SwarmObjectSelector"
    },
    "tail": {
      "default": 100,
      "format": "uint64",
      "maximum": 500,
      "minimum": 1,
      "type": "integer"
    },
    "target": {
      "$ref": "#/$defs/DetailInput"
    },
    "timestamps": {
      "default": false,
      "type": "boolean"
    }
  },
  "required": [
    "target",
    "service"
  ],
  "$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.

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