Skip to main content
Glama

debug_backtrace

Reconstruct an approximate call stack from PC, LR, and a heuristic stack scan on a halted STM32 core, returning likely return addresses innermost first for crash analysis.

Instructions

Reconstruct an approximate call stack from PC, LR, and a stack scan.

Requires a halted core and an ELF-loaded session. The stack scan is a heuristic: it reports PC, LR, then likely return addresses (thumb addresses into code symbols) found in the stack window, in stack order.

Args: session_id: Session ID from debug_session_start. words: Stack words to scan (default 64, max 256).

Returns: Approximate call frames, innermost first.

Input Schema

NameRequiredDescriptionDefault
wordsNo
session_idYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/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. It does disclose the key trait that the result is a heuristic approximation, the frame ordering (innermost first, stack order), and the state requirements. However, it says nothing about failure modes when the core isn't halted, whether the call has any side effects on the session, or how much the output should be trusted versus a symbol-resolved backtrace.

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 one-line purpose, then prerequisites, then the heuristic caveat, then conventional Args/Returns. Every sentence carries information; nothing is repeated from the schema or padded.

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, so return-format detail isn't required, and the description still gives the frame ordering. Combined with stated prerequisites and the heuristic caveat, an agent has enough to invoke it correctly; only error/edge-case behavior is left unstated.

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 0% (titles only), and the description compensates well for both params: session_id is tied to debug_session_start, and words gets a default (64) plus a hard cap (256) plus meaning ('stack words to scan'). That is real added value, but the depth is modest for a tool whose accuracy depends heavily on window size, so it sits just above baseline rather than at the top.

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 ('Reconstruct an approximate call stack') and names the exact inputs it works from (PC, LR, stack scan), which clearly separates it from siblings like debug_registers or debug_mem that return raw state rather than a reconstructed frame list.

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 preconditions — a halted core and an ELF-loaded session — which tell an agent when the call is valid and imply debug_halt / symbol loading must precede it. It stops short of naming alternatives (e.g. debug_registers for exact register values) or what to do when the heuristic is unreliable.

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