Skip to main content
Glama

pio_flash_and_verify

Builds and flashes embedded firmware, then monitors the serial boot log to verify an expected healthy output, detect crashes with decoded file:line details, or report a timeout.

Instructions

Hardware-in-the-loop check with no human: build + flash (pio run -t upload), then open the serial port and watch the boot log until expect (regex) matches -> verdict pass, or fail_on matches -> verdict fail with the crash automatically decoded to file:line, or timeout_s elapses -> verdict timeout. Port and baud come from platformio.ini (monitor_port/monitor_speed) or the single detected board. Set expect to a line your firmware prints once it is healthy, e.g. 'WiFi connected'. Blocked under build_only/read_only policy.

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

Input Schema

NameRequiredDescriptionDefault
envNo
baudNo
expectNosetup done|ready|started|Booting|loop
fail_onNoGuru Meditation|panic'ed|abort\(\) was called|assert failed|HardFault|Hard Fault|BusFault|UsageFault|MemManage|stack overflow|Task watchdog|Brownout|CORRUPT HEAP|Backtrace:|rst:0x[0-9a-f]+ \((?:SW_CPU_RESET|TG\dWDT_SYS_RESET|RTCWDT_RTC_RESET|PANIC)
settle_sNo
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.
max_linesNo
timeout_sNo
project_dirNo
upload_portNo
monitor_portNo
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.
stop_open_sessionsNo

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

A4.1/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does well: it discloses side effects (firmware is overwritten via `pio run -t upload`), the three terminal verdicts including automatic crash decoding to file:line, the timeout behaviour, and policy-based blocking. It omits whether the board is reset/powered, whether an already-open monitor session is disrupted, and any permission or exclusive-port requirements, which are the notable remaining gaps for a state-mutating hardware tool.

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?

A single dense paragraph that front-loads the core action (build + flash, then watch the boot log) before listing verdicts, port sourcing, and the policy caveat. The arrow-chained verdict enumeration is compact and readable; a couple of clauses (policy blocking at the very end) could be hoisted for faster scanning, but there is essentially no filler.

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-shape explanation is not owed, and the description still names the three verdicts and crash decoding. Combined with the policy note and the expect/fail_on guidance, an agent can call it correctly without further reading, though the undocumented secondary parameters (settle_s, max_lines, stop_open_sessions) leave some operational uncertainty.

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 only 15% across 13 parameters, so the description must compensate, and it does for the critical ones: `expect` and `fail_on` are clarified as regexes with concrete example/pattern semantics, `timeout_s` as the third verdict branch, and `baud`/`monitor_port` as defaulting from platformio.ini or the single detected board. However, roughly half the parameters (settle_s, max_lines, upload_port vs monitor_port, stop_open_sessions, project_dir, env) get no explanation, leaving real ambiguity for a 13-param surface.

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 compound verb chain (build + flash + monitor boot log) against a concrete resource (the detected board / platformio.ini env), and the three outcome verdicts. It is clearly distinguishable from a plain pio_build or pio_monitor_capture because it fuses flash-and-observe into one pass/fail judgement.

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 a clear usage context (hardware-in-the-loop verification with no human), a when-not ('Blocked under build_only/read_only policy'), and practical guidance on choosing `expect` ('a line your firmware prints once it is healthy, e.g. WiFi connected'). It never names a sibling alternative such as pio_build plus pio_monitor_capture as the manual fallback, so it stops just short of explicit routing.

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