Skip to main content
Glama

Delete an LVGL widget from a page

esphome_lvgl_delete_widget
DestructiveIdempotent

Delete a specific LVGL widget by ID from an ESPHome page and save the full config. A .bak backup is created before the YAML rewrite.

Instructions

Delete an LVGL widget by id from a page on an ESPHome device and save the whole config.

Removes the matching widget from the page's widgets list, then rewrites the entire device YAML file via yaml.dump — comments, blank lines and YAML anchors/aliases elsewhere in the file are NOT preserved. A <file>.bak copy of the previous content is written first so the original formatting can be recovered manually.

Use when: removing one widget from an existing LVGL page. Not for: adding a widget — use esphome_lvgl_add_widget. After deleting, run esphome_lvgl_validate/esphome_validate_config, then esphome_compile_device and esphome_upload_device to deploy. Returns: {"success": True, "name": ..., "bytes": ..., "backup": ..., "deleted": <widget_id>, "from_page": <page_id>} on success. Errors: {"error": "..."} when the file can't be found/parsed, when there is no lvgl: section, when page_id/widget_id doesn't exist, or when the save itself fails ({"success": False, "error": ...}). Limits: rewrites and overwrites the whole file; only the pre-write content is recoverable, via the .bak copy.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idYesLVGL page ID the widget belongs to, from `esphome_lvgl_get_pages`.
widget_idYesWidget `id` to delete, from `esphome_lvgl_get_page_widgets`.
device_nameYesDevice name, with or without the '.yaml' suffix, e.g. 'kitchen_display'.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.25.1
    • addedInput schema / properties / device_name / description
      Added value: +"Device name, with or without the '.yaml' suffix, e.g. 'kitchen_display'."
    • addedInput schema / properties / page_id / description
      Added value: +"LVGL page ID the widget belongs to, from `esphome_lvgl_get_pages`."
    • addedInput schema / properties / widget_id / description
      Added value: +"Widget `id` to delete, from `esphome_lvgl_get_page_widgets`."
  2. Addedv0.18.2

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true, idempotentHint=true and readOnlyHint=false, so safety is partly covered. The description goes well beyond them: it discloses that the whole YAML file is rewritten via yaml.dump, that comments, blank lines and anchors/aliases are NOT preserved, that a .bak copy is written first, and that only pre-write content is recoverable manually. That is exactly the operational risk an agent needs before invoking a destructive 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?

Front-loaded with the core action and structured with clear labels (Use when / Not for / Returns / Errors / Limits), so it scans well. It is somewhat long, and the Returns section partially duplicates the existing output schema, which is minor redundancy rather than wasted space.

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 file-mutating tool, the description covers purpose, routing, side effects, backup/recovery, error modes and the deployment follow-up path. An output schema exists so return-value detail is optional, and nothing an agent needs to call this safely is missing.

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 100%, so all three parameters are already documented in the schema (including where page_id and widget_id come from). The description repeats widget_id/page_id context in its error section but adds no new syntax, format or constraint information. Baseline 3 applies when the schema does the heavy lifting.

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 (Delete), resource (LVGL widget by id), and scope (from a page on an ESPHome device, then save the whole config). It explicitly names the sibling it is not (esphome_lvgl_add_widget), so an agent can distinguish it without opening any 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?

Has an explicit 'Use when: removing one widget from an existing LVGL page' and 'Not for: adding a widget — use esphome_lvgl_add_widget', plus the correct follow-up sequence (validate -> compile -> upload). This is when/when-not/alternatives in full.

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