Skip to main content
Glama

flash_firmware

Program firmware binaries to STM32, ESP, and Cortex-M boards with dry-run preview and confirm safeguards, then reset the target to run.

Instructions

烧录固件到开发板(不可逆操作,双闸门)。

第一道:dry_run 默认 True,只返回将要执行的完整命令供逐字核对,不写 flash。 第二道:真正执行必须 dry_run=False 且 confirm=True —— 两道都齐才会写。 另受隔离档位管辖:MCU_DEBUG_MCP_MODE 为 readonly(默认)时直接拒绝。 STM32+ST-Link(默认首选,实测最稳): flash_firmware("app.bin", chip="stm32h563") → STM32_Programmer_CLI -c port=SWD mode=normal -w app.bin 0x08000000 -v -rst 接多台同型号调试器时用 sn 指定探针序列号。 ESP 系:flash_firmware("app.bin", chip="esp32", port="COM5") 通用 Cortex-M:flash_firmware("app.elf", tool="pyocd", chip="stm32f103c8") 烧完自动 -rst 复位;不复位的话 SWD 会把内核 halt 住,板子不会跑。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
snNo
chipNo
portNo
toolNoauto
confirmNo
dry_runNo
file_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so richly: it discloses the two-gate dry_run/confirm write path, the readonly isolation mode that refuses outright, and the auto-reset behavior plus the concrete consequence (halted SWD core, board won't run) if reset is skipped. This is exactly the behavioral context an agent needs for an irreversible action.

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 safety-critical double-gate and isolation constraints are front-loaded before the examples, and each section earns its place. It is fairly long and dense, but the density is justified by the irreversible nature of the operation rather than padding.

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

Completeness5/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-value documentation is unnecessary. For a high-risk mutation tool with 7 parameters and zero schema coverage, the description still covers safety gates, auth/isolation gating, per-family usage, probe selection and post-flash reset behavior — nothing an agent needs to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it explains the semantics of dry_run (default True, returns command only), confirm (must be True together with dry_run=False), sn (probe serial for multiple same-model debuggers), chip, port and tool through worked examples. It leaves file_path format (absolute/relative) and the tool default 'auto' meaning unstated, so not quite complete.

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 precise verb+resource (flash firmware to a dev board) and immediately flags the operation as irreversible. This clearly distinguishes it from read-only siblings like flash_verify, flash_tool_detect and chip_info, so an agent knows this is the actual write path.

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 when-to-use scenarios per chip family (STM32/ST-Link default, ESP, generic Cortex-M via pyocd) and states the default-preferred toolchain. It stops short of naming explicit alternatives/exclusions against siblings, but the usage context is concrete and actionable.

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