Skip to main content
Glama

service_stats

Read live CPU, memory, network and PID usage for a running service to see how much a healthy service consumes. Branch on the available flag: null counters mean unknown, not idle.

Instructions

Get live CPU, memory, network and PID usage for a running service.

    Returns ``{available, stats: {cpu_pct, mem_used_bytes, mem_limit_bytes,
    mem_pct, net_rx_bytes, net_tx_bytes, pids}, gpus, cached}``.

    **Branch on ``available``, never on zeroes.** ``available: false`` with
    ``stats: null`` is the normal answer when the service has no running
    container or the daemon cannot reach Docker; every individual counter
    is likewise ``null`` when unknown, so a missing metric never
    masquerades as an idle one. ``cpu_pct`` follows the docker convention —
    ``100.0`` is one fully-used core, so a multi-core host can exceed 100.

    For *why* a service is unhealthy use ``diagnose_service``; this tool
    answers *how much* a healthy one is consuming. The daemon caches the
    sample for 2 seconds, so polling it in a loop is cheap.
    

Input Schema

NameRequiredDescriptionDefault
nameYesService name or job id of an existing service (app, model or database); both resolve to the same row.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/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 burden and does so: it discloses the availability contract, null-vs-zero semantics, the docker cpu_pct convention where 100.0 is one core, and the daemon cache TTL. These are non-obvious traits an agent cannot infer from the schema.

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

Conciseness5/5

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

Front-loaded with the purpose, then the return shape, then the critical branching rule, then routing guidance. Every sentence adds decision-relevant information, including the counterintuitive null-masquerade warning; no filler.

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?

No output schema exists, so the description supplies the response shape explicitly and warns how to interpret it. For a single-parameter read tool, nothing an agent needs to call it correctly is missing.

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

Parameters3/5

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

Only one parameter and schema coverage is 100%, so the schema already documents that 'name' accepts a service name or job id. The description adds nothing about the parameter, which is acceptable given the baseline for fully-covered single-parameter schemas.

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

Purpose5/5

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

States a specific verb ('Get live CPU, memory, network and PID usage') and a precise resource scope ('for a running service'). It also explicitly separates itself from the sibling diagnose_service by framing this tool as answering 'how much' rather than 'why'.

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

Usage Guidelines5/5

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

Gives an explicit routing rule: 'For why a service is unhealthy use diagnose_service; this tool answers how much a healthy one is consuming.' It also tells the agent that loop-polling is acceptable due to the 2-second cache, which is actionable when-to-use guidance.

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