Skip to main content
Glama

analyze_stack

Read-onlyIdempotent

Reports stack used and free bytes for a halted STM32 core, then checks a given size or limit to deliver a clear overflow verdict. Use it to diagnose stack overflows during firmware debugging.

Instructions

Reports stack used/free bytes and a clear overflow verdict for the halted core. stack_top defaults to the initial MSP (first word of the vector table at vector_table_addr). Give stack_size or stack_limit for the overflow check (else only usage is reported). The key tool for diagnosing stack overflows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionNoOptional debug-session name. Omit for the default target.
stack_topNoTop-of-stack address (hex). Default: initial MSP from the vector table.
stack_sizeNoStack size in bytes (used as stack_top - stack_size if stack_limit omitted).
stack_limitNoLowest valid stack address (hex).
vector_table_addrNoVector table base for the initial MSP (default '0x08000000').

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.15.1

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the safety burden is lifted. The description adds meaningful context beyond them: it only works on a halted core, and the overflow verdict is conditional on stack_size/stack_limit being supplied. It does not describe the return payload structure, but with annotations covering behavior this is solid.

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 what is reported, then the defaults/parameter rules, then the positioning statement. Four compact sentences, each doing work; only slight overlap with the schema on parameter behavior.

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?

With no output schema, the description adequately covers what comes back (used/free bytes plus a verdict) and the precondition (halted core, overflow check needs a size or limit). An agent has enough to invoke it correctly, though return-format detail is left implicit.

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 description coverage is 100%, so the schema already documents all five parameters. The description adds minor value by restating the stack_top default source and the stack_size vs stack_limit relationship, but mostly echoes the schema. Baseline 3 applies.

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+resource ('Reports stack used/free bytes') plus a distinct outcome ('a clear overflow verdict for the halted core'), which separates it from nearby siblings like read_call_stack or diagnose_fault. The closing line 'key tool for diagnosing stack overflows' pins down its niche explicitly.

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?

Explains the conditional behavior clearly: provide stack_size or stack_limit for the overflow check, otherwise only usage is reported. It also scopes the tool to a 'halted core'. It does not name alternative sibling tools, so it falls 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.