Skip to main content
Glama

pio_decode_backtrace

Decode ESP32/ESP-IDF, RISC-V, and Cortex-M crash dumps or monitor buffers into function, file, and line source locations to identify where firmware crashed.

Instructions

Turn a crash dump into source locations. Give text containing an ESP32/ESP-IDF 'Guru Meditation' register dump and 'Backtrace: 0x...:0x...' line, a RISC-V ESP32 (C2/C3/C5/C6/C61/H2/H4/P4/S31) MEPC/RA register dump with its 'Stack memory:' block, or a Cortex-M HardFault pc/lr dump, or give session_id of an open monitor session to scan its buffer. Xtensa and Cortex-M addresses are resolved with the toolchain's addr2line; RISC-V stacks are unwound with the toolchain's GDB into a full call chain (method=gdb_unwind), or, without GDB, stack words pointing into code are resolved (method=stack_scan, may include stale frames). Returns function, file, line per frame, plus the crash cause and reset reason. The ELF must be from the same build that was flashed.

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_decode_backtrace"
  }
}

Input Schema

NameRequiredDescriptionDefault
envNo
textNo
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.
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.
include_all_hexNo

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. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the disclosure burden and does well: it names the resolution mechanisms (addr2line vs GDB unwind vs stack_scan), warns that stack_scan 'may include stale frames', and flags the ELF/build-mismatch failure mode. It does not state permissions, failure/error responses, or timeouts, but the algorithmic behavior is unusually well exposed.

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?

The core purpose is front-loaded in the first sentence, followed by the input modes, then the resolution methods, then the return value and the ELF caveat. It is dense and mostly earns its length, though the parenthetical chip-family list and dual method naming make the middle sentence 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?

For a diagnostic tool with an output schema (so return shape needs only light coverage) the description supplies the accepted input formats, the build-match prerequisite, and the caveat about stale frames. Remaining gaps are the undocumented optional parameters (`env`, `project_dir`, `include_all_hex`), which an agent would have to guess at.

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 29% and 7 optional parameters exist, so the description must compensate. It gives rich semantics for `text` (three concrete dump shapes) and `session_id`, but says nothing about `env`, `project_dir`, or `include_all_hex`, leaving half the parameters relying on bare titles. The `llm_model` and `conversation_id` analytics params are documented only in the schema.

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 outcome ('Turn a crash dump into source locations') and immediately enumerates the accepted dump formats (Xtensa Guru Meditation, RISC-V MEPC/RA with 'Stack memory:', Cortex-M HardFault). It is unambiguous what the tool produces, though it never names or contrasts a sibling such as pio_coredump or pio_monitor_read, which likely overlaps with the session-buffer scanning path.

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

Usage Guidelines3/5

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

It clearly explains the two input modes (paste `text` vs pass `session_id` of an already-open monitor session) and states a hard prerequisite: 'The ELF must be from the same build that was flashed.' However there is no explicit when-not guidance or routing to alternatives, and the fallback behavior (gdb_unwind vs stack_scan when GDB is unavailable) is described as automatic rather than as something the caller chooses.

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