Skip to main content
Glama

pio_memory_watch

Monitors serial output to analyze heap and stack telemetry, diagnose memory leaks, fragmentation, and low stack headroom.

Instructions

Watch serial output for heap and stack telemetry and diagnose leaks, fragmentation, and stack headroom. Give session_id of an open monitor session (its buffer plus seconds more) or a port for a one-shot capture. Understands Arduino-ESP32 'Free heap: N min: N largest: N', ESP.getFreeHeap() prints, ESP-IDF heap_caps_print_heap_info blocks, FreeRTOS vTaskList tables, and uxTaskGetStackHighWaterMark lines; pattern (regex with a (?P) group) adds a custom metric. Returns per-metric min/max/trend with a stable/shrinking/growing verdict, a per-task stack table flagged below stack_warn_bytes, and a fragmentation hint. When the firmware prints nothing usable, instrumentation_hint has copy-paste snippets.

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": "pio_memory_watch"
  }
}

Input Schema

NameRequiredDescriptionDefault
envNo
baudNo
portNo
patternNo
secondsNo
llm_modelNoThe model identifier you are running as, for example "claude-opus-4-8" or "gpt-5.2". Pass "unknown" if you are not certain. Recorded for the server developer's analytics.
max_linesNo
session_idNo
project_dirNo
conversation_idNoThe conversation_id this server returned earlier in this conversation, unchanged, including after later user messages. Omit it if you have none. Recorded for the server developer's analytics.
stack_warn_bytesNo

Output Schema

NameRequiredDescriptionDefault
_mcp_instructionsNoServer-issued metadata for this conversation.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.9.0
    • removedInput schema / properties / context
      Removed value: -{
      -  "description": "A few words on why you are calling this tool, for the server developer's analytics. Describe people and things by role, such as \"a customer\". Do not quote the user or include names, emails, or other personal details.",
      -  "type": "string"
      -}
    • removedInput schema / required
      Removed value: -[
      -  "context"
      -]
  2. Changed5 schema fields changedv0.6.2
    • addedInput schema / properties / context
      Added value: +{
      +  "description": "A few words on why you are calling this tool, for the server developer's analytics. Describe people and things by role, such as \"a customer\". Do not quote the user or include names, emails, or other personal details.",
      +  "type": "string"
      +}
    • addedInput schema / properties / conversation_id
      Added value: +{
      +  "description": "The conversation_id this server returned earlier in this conversation, unchanged, including after later user messages. Omit it if you have none. Recorded for the server developer's analytics.",
      +  "type": "string"
      +}
    • addedInput schema / properties / llm_model
      Added value: +{
      +  "description": "The model identifier you are running as, for example \"claude-opus-4-8\" or \"gpt-5.2\". Pass \"unknown\" if you are not certain. Recorded for the server developer's analytics.",
      +  "type": "string"
      +}
    • addedInput schema / required
      Added value: +[
      +  "context"
      +]
    • addedOutput schema / properties
      Added value: +{
      +  "_mcp_instructions": {
      +    "description": "Server-issued metadata for this conversation.",
      +    "properties": {
      +      "conversation_id": {
      +        "description": "The server-issued conversation identifier.",
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  }
      +}
  3. Addedv0.2.0

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does good work by promising a verdict per metric, a stack table flagged below stack_warn_bytes, a fragmentation hint, and instrumentation_hint snippets when parsing fails. It omits the operational side: whether opening a port conflicts with a running monitor session, what happens on capture timeout, or whether the tool mutates anything. That is the gap for a hardware-touching tool with zero annotation coverage.

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 purpose, then capture mode, then supported formats, then return shape. Dense but each clause adds selection value, especially the list of recognized firmware print formats. The long format enumeration is justified but slightly heavy.

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

Completeness4/5

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

An output schema exists, yet the description still sketches the return shape (per-metric min/max/trend, verdict, stack table, fragmentation hint), which is enough to decide if the tool fits. The main shortfall is undocumented capture parameters (env, baud, project_dir, max_lines) on an 11-parameter tool. Otherwise it is complete for the diagnostic task.

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?

Schema coverage is only 18%, and the description covers four parameters well: session_id versus port as the two capture sources, `seconds` as extra capture time, `pattern` as a regex requiring a named (?P<value>) group, and stack_warn_bytes as the flag threshold. It is silent on env, baud, project_dir, and max_lines, which matter for actually targeting a capture. Partial compensation.

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 and resource ("Watch serial output for heap and stack telemetry") and adds the diagnostic intent (leaks, fragmentation, stack headroom). That distinguishes it from capture/read siblings, which only relay raw serial text. An agent knows exactly which question this tool answers.

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 concrete invocation modes: pass session_id to reuse an open monitor session's buffer plus `seconds` more, or pass a port for a one-shot capture. That is real routing guidance. It never names an alternative tool or an explicit when-not condition, so it stops short of a 5.

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