container_stats
Get a point-in-time resource usage snapshot for a container, returning raw engine stats. Compute CPU percent from delta data or use one_shot for faster memory and PID stats without CPU calculation.
Instructions
Get one point-in-time resource-usage snapshot for a container (non-streaming).
Returns the raw engine stats payload; CPU percent must be computed from the delta between
cpu_stats and precpu_stats. By default the daemon collects two cycles before answering,
which is what fills precpu_stats - so the call takes about a second. one_shot=True returns
after a single collection instead, leaving precpu_stats zeroed and CPU percent uncomputable;
use it when only memory_stats/pids_stats matter. For a pre-computed human-readable summary
prefer the docker-stats://{id_or_name} resource; for a process listing use container_top.
Args:
one_shot: Skip the second collection cycle for a faster answer, at the cost of an empty
precpu_stats (so no CPU percent); needs daemon API v1.41+
Returns: dict: Engine stats payload (read, cpu_stats, precpu_stats, memory_stats, networks, pids_stats, ...)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id_or_name": "<id_or_name>"
},
"name": "container_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| one_shot | No | ||
| id_or_name | Yes |