Skip to content

Type upsert_automation's location and automation in the MCP tool schema #2795

Description

@bdraco

upsert_automation on the MCP endpoint declares location and automation as bare objects; the whole shape lives in the tool description. #2794 gives the tool library enum, array items and closed nested objects (closed_object), so both arguments can carry a real schema that Home Assistant's schema conversion shows the model and the validator refuses up front.

Proposed shape:

  • location: closed object over every key any kind uses (kind as an enum of the seven kinds, component_id, trigger, index, id, field, action_name), only kind required; the per kind key check stays in the handler.
  • automation: closed object with trigger_params (object) and actions (array of closed {action_id, params, children, conditions} items). children and conditions stay plain containers since the item schema cannot express recursion.

Depends on #2794 landing, then a PR stacked on #2789. Raised by Copilot on #2789 (#2789 (comment)); the description was expanded there and this is the structural follow up.

Scope note (after #2798): this types the tool call's own structure only, the location keys are Device Builder's wire model and action_id / condition_id are strings. params and trigger_params stay open objects, never enumerated against the catalog; esphome validates fields through validate_config.

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