Skip to content

Catch invented automation fields at the MCP tool boundary, not in the shared writer #2797

Description

@bdraco

In the end to end runs through Home Assistant the model invented a field on its first upsert_automation call twice (switch_id, then switch on switch.turn_off) and recovered only after validate_config reported the esphome error. #2793 tried to refuse such trees in the shared writer by checking params against the catalog's field lists and was closed: the catalog is a lossy copy of rules esphome owns (measured against esphome 2026.9.0: emontx.send_command requires command but the catalog lists only id, and 54 registry entries could not be compared at all), and the visual editor auto-applies the whole parsed tree through the same writer, so any gap makes an existing valid automation impossible to edit.

Direction: esphome is the validator. The model must run validate_config after every write and repair from esphome's own error (replace with expected). Remaining work is on the MCP side only:

  • Description: done in Add an upsert_automation MCP tool that lands an automation in the right place #2789 (e179780), the tool now says esphome checks the fields and to run validate_config after every write and repair with expected.
  • Consider running esphome config inside upsert_automation and appending its result to the reply, so the model sees the real error in the same call; only if it fits Home Assistant's 10 second per call budget on a Pi, otherwise leave the two calls separate.

The shared automations/upsert writer stays validation free. Context: #2789 (the upsert tool), #2793 (closed).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions