Skip to main content
Glama

flash_erase

Destructive

Erase a target flash range by address and length to clear corrupt OTA journals, stale boot descriptors, or half-written images and recover a non-booting board.

Instructions

Erases a flash range on the target (OpenOCD 'flash erase_address pad'), rounding out to the driver's erase-sector boundaries. The recovery tool for a board that will not boot: clearing a corrupt OTA journal, a stale boot descriptor, or a half-written image. Requires an explicit address AND length — there is deliberately no mass-erase default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lengthYesBytes to erase. Rounded UP to the erase-sector boundary.
verifyNoRead back the first 64 bytes and confirm they hold this part's erased value — 0x00 on STM32L0/L1, 0xFF elsewhere, taken from the profile MCU (default true).
addressYesStart address, e.g. '0x08016000'. Rounded DOWN to the erase-sector boundary.
sessionNoOptional debug-session name. Omit for the default target.
sector_size_bytesNoErase-sector size of this part (e.g. 4096 on STM32L1, up to 131072 on F4). Give it and the write guard checks the padded range that is really erased; omit it and the guard can only check the range you asked for.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.15.1

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare destructive=true and idempotent=false, so the safety profile is covered. The description adds real context beyond that: the driver-boundary rounding behavior, the deliberate absence of a mass-erase default, and the recovery framing. It does not describe failure/abort behavior or what the call returns.

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?

Three sentences, front-loaded with the core action, then use case, then the key constraint. The OpenOCD parenthetical adds precision without padding; nothing is wasted.

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 destructive, non-idempotent tool with no output schema and annotations covering safety, the description supplies purpose, trigger scenarios, required-arg expectations, and boundary/verify behavior. The only gap is the absence of any statement about the outcome or failure modes after erasing, but the verify parameter partially compensates.

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 length/address rounding, verify, session, and sector_size. The description only reinforces that both address and length are mandatory and explains the design rationale ('deliberately no mass-erase default'); it adds no per-parameter meaning beyond the schema, so 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?

Precise verb+resource: 'Erases a flash range on the target,' reconciled with the OpenOCD 'flash erase_address pad' primitive. The scope ('rounded out to the driver's erase-sector boundaries,' 'no mass-erase default') is distinct from flash_firmware/write_memory, which write rather than erase an arbitrary range.

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?

Clear when-to-use context: 'The recovery tool for a board that will not boot,' with three concrete scenarios (corrupt OTA journal, stale boot descriptor, half-written image). It gives strong positive guidance but does not explicitly name an alternative tool or an exclusion condition relative to siblings like flash_firmware.

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