Skip to main content
Glama
Apple Container MCP Server

Apple Container MCP Server

by joeshirey

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

NameRequiredDescriptionDefault
containersNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.7.2

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and does so thoroughly: it discloses the minimum CLI version (0.12+), explains that it always invokes `--no-stream` because the default streaming mode would block the subprocess, and documents success and error response shapes. It even flags an additive `cpuUtilization` field that may be present or omitted depending on whether the second sample succeeds, which an agent could not infer anywhere else.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the one-line purpose, then version prerequisite, then the streaming caveat, then Args/Returns. Every section is relevant, though the Returns block is somewhat long given an output schema already exists, and the nested `cpuUtilization` caveat could be compressed to a single clause.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-optional-parameter read tool with no annotations, the description covers the prerequisite version, the non-streaming execution model, defaulting behavior, parameter forms, and both success and error envelopes. Nothing an agent needs in order to call this correctly and interpret the response is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does: it explains the meaning of null versus an empty list versus a non-empty list, notes that entries may be IDs or names, and gives a concrete single-container example (`["abc"]`). This is meaning well beyond what the bare `anyOf` array-of-strings schema conveys.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Get a one-shot resource-usage snapshot for one or more containers.' The 'one-shot'/'snapshot' framing distinguishes it from a monitoring stream, but it never contrasts itself with the adjacent siblings an agent might confuse it with, such as inspect_container or list_containers.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives clear context for use: pass None or an empty list for all running containers, a non-empty list for named containers. It also redirects the streaming use case to the `container stats` CLI directly. It stops short of naming which sibling tool to use when the agent actually wants config details rather than live usage, which is the main remaining ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.