stats_container
Get a one-shot resource-usage snapshot for all running containers or specified containers, returning CPU, memory, and related stats without continuous streaming.
Instructions
Get a one-shot resource-usage snapshot for one or more containers.
Requires Apple Container 0.12+ (the `stats` subcommand was added in 0.12).
This MCP tool always uses the non-streaming form (`--no-stream`) to fit the
request/response model. The CLI's default streaming mode would block the
subprocess until killed by our timeout. For continuous streaming, use the
`container stats` CLI directly.
Args:
containers: Optional list of container IDs or names.
- None or empty list: return stats for ALL running containers.
- Non-empty list: return stats for the named containers.
For a single container, pass a single-element list, e.g. ["abc"].
Returns:
On success: {"status": "ok", "stats": <list of per-container stats>}
Each entry is the parsed `StatsReport` JSON object the CLI emits per
container. In Apple Container 1.7.1+, `StatsReport` includes an additive
`cpuUtilization` field (a core-fraction float where `1.0` equals one full
core), omitted when the second sample fails; parsed `StatsReport` entries
are returned unchanged whether `cpuUtilization` is present or omitted.
On error: {"status": "error", "message": str, "details": str}
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "stats_container"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| containers | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |