Skip to main content
Glama

Flash firmware to an ESPHome device

esphome_upload_device
Destructive

Flash a compiled firmware build to an ESPHome device over OTA or serial, with confirmation required before overwriting the running firmware.

Instructions

Flash previously compiled firmware to an ESPHome device via the dashboard's /upload WebSocket route.

Requires the device to already be built (esphome_compile_device) and, for OTA, reachable with a matching OTA password. Without confirm=True returns a confirmation prompt and performs no I/O (ADR-0004 D5) — this overwrites the running firmware with no automatic rollback if broken. Same "ESPHome Device Builder" (esphome/device-builder) spawn wire protocol as esphome_compile_device, on /upload.

Use when: deploying a compiled build to the device, once confirmed. Not for: building the firmware — use esphome_compile_device first. Returns: {"device", "action": "upload", "exit_code", "success", "log_tail", "log_lines"} on completion. Errors: {"error": "confirmation_required", "message", "action"} when confirm is false (checked first, before name is resolved); {"error": "Invalid device name: ..."} for a path-escaping or blocked (e.g. 'secrets') name; otherwise one of esphome_dashboard.DashboardError's stable codes — esphome_unreachable/esphome_auth_required add diagnosis (see esphome_ping_dashboard); timeout adds log_tail/log_lines/ job_may_still_be_running (always True — do not retry, check esphome_get_addon_logs); esphome_command_failed adds dashboard_error_code/details. Limits: requires confirm=True; blocks up to timeout seconds; no rollback if the upload succeeds but firmware is broken.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesDevice name, with or without the '.yaml' suffix, e.g. 'kitchen_sensor'.
portNo'OTA' for wireless flash (default) or a serial device path, e.g. '/dev/ttyUSB0', for a wired flash.OTA
confirmNoSet true to actually flash the device. False (default) performs no action and instead returns a confirmation prompt; `name` is not resolved or touched in that case.
timeoutNoMaximum seconds to wait for the upload to finish, e.g. 240.
log_linesNoNumber of trailing upload-log lines to return, e.g. 200.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.25.1
    • addedInput schema / properties / confirm
      Added value: +{
      +  "default": false,
      +  "description": "Set true to actually flash the device. False (default) performs no action and instead returns a confirmation prompt; `name` is not resolved or touched in that case.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / log_lines
      Added value: +{
      +  "default": 200,
      +  "description": "Number of trailing upload-log lines to return, e.g. 200.",
      +  "type": "integer"
      +}
    • addedInput schema / properties / name / description
      Added value: +"Device name, with or without the '.yaml' suffix, e.g. 'kitchen_sensor'."
    • addedInput schema / properties / port
      Added value: +{
      +  "default": "OTA",
      +  "description": "'OTA' for wireless flash (default) or a serial device path, e.g. '/dev/ttyUSB0', for a wired flash.",
      +  "type": "string"
      +}
    • addedInput schema / properties / timeout
      Added value: +{
      +  "default": 240,
      +  "description": "Maximum seconds to wait for the upload to finish, e.g. 240.",
      +  "type": "number"
      +}
  2. Addedv0.18.1

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true, but the description adds substantial context beyond them: the confirm=True gate (ADR-0004 D5), that confirm=False performs no I/O and does not resolve `name`, that the operation blocks up to `timeout` seconds, and that there is no automatic rollback if the firmware is broken. It also enumerates stable error codes and their extra fields, which is exactly the kind of operational detail annotations cannot carry.

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?

Despite its length, it is tightly structured with front-loaded purpose followed by labeled Use when / Not for / Returns / Errors / Limits blocks. Every section carries actionable content — prerequisites, destructive warning, error taxonomy — with no filler sentences.

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?

For a destructive, non-idempotent flashing tool this covers everything an agent needs: prerequisite build step, confirmation gate, transport choice, blocking behavior, and a complete error-code map including the 'do not retry' timeout guidance. Return values are duplicated from the output schema, but that is a minor redundancy rather than a gap.

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 coverage is 100%, so the schema already documents all five parameters and the baseline is 3. The description adds real value beyond that by disclosing evaluation order ('confirm is checked first, before `name` is resolved') and that `name` is untouched when confirm is false, which the schema does not state.

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 (flash/upload), the resource (previously compiled firmware to an ESPHome device), and the exact transport route. It explicitly distinguishes itself from the sibling esphome_compile_device ('Requires the device to already be built'), so an agent can route correctly without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Contains explicit 'Use when: deploying a compiled build to the device, once confirmed' and 'Not for: building the firmware — use `esphome_compile_device` first', plus the OTA-password prerequisite. This is a textbook when/when-not/alternative statement.

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

Deploy Server

Other Tools