Skip to main content
Glama

Build card config from recipe

card_builder_build_from_recipe
Read-onlyIdempotent

Transform a recipe shorthand into a full DocumentData config dict to create or update Home Assistant cards. Builds the block tree from recipe blocks automatically.

Instructions

Materialise a recipe shorthand into a full DocumentData (config) dict.

Builds a canvas root wrapping one block-container, recursively turns recipe["blocks"] into the block tree via _build_block_tree (auto-inserting block-drop-zone children for layout blocks and auto-wrapping raw prop scalars in {"value": ...}), and returns the assembled {version, rootId, slots, blocks} dict. Pure computation — makes no call to Home Assistant.

Use when: turning a recipe (hand-written or from card_builder_get_card_template) into the config to pass to card_builder_create_card/card_builder_update_card. Not for: hand-crafted low-level DocumentData — assemble that directly instead; a template-driven one-shot creation — use card_builder_make_template_card. Returns: a dict ready to pass as config to card_builder_create_card. Errors: raises ValueError when recipe["root_slot"] isn't defined in recipe["slots"], when a block in recipe["blocks"] has an unknown or internal type, or when a non-container block type is given children. Limits: run card_builder_validate_config on the result before saving — this tool does not validate the produced tree itself.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipeYesRecipe shorthand: {slots, root_slot|root_entity, blocks, root_styles, root_dz_styles, canvas_styles, action_slots, ...} — see card_builder_recipe_guide for the full shape.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.25.1
    • addedInput schema / properties / recipe / description
      Added value: +"Recipe shorthand: {slots, root_slot|root_entity, blocks, root_styles, root_dz_styles, canvas_styles, action_slots, ...} — see card_builder_recipe_guide for the full shape."
  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 declare read-only/idempotent/non-destructive, and the description corroborates while adding context annotations cannot: it is pure computation making no Home Assistant call, and it lists the exact ValueError conditions (undefined root_slot, unknown/internal block type, children on a non-container). It also discloses the 'does not validate the tree' limitation and the validate_config follow-up.

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?

Front-loads the core purpose, then uses labeled sections (Use when / Not for / Returns / Errors / Limits) that each carry distinct, non-redundant information. No filler sentences; the length is justified by the tool's complexity.

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 complex nested-input tool this covers purpose, routing, transformation behavior, error modes, and the required post-step (validate_config). With an output schema present it needn't explain return values, yet it still notes the result is ready to pass as config.

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?

The single param has 100% schema coverage and the schema already describes the recipe shape, so baseline is 3. The description goes further by explaining what happens to recipe['blocks'], root blocks, and scalars, and by pointing to card_builder_recipe_guide for the full shape, adding real value beyond the schema.

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 and transformation: 'Materialise a recipe shorthand into a full DocumentData (config) dict,' and details the internal work (_build_block_tree, drop-zone insertion, scalar wrapping). It also names the siblings it complements (card_builder_create_card/update_card) and contrasts with card_builder_make_template_card, 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?

Explicit 'Use when' (turning a recipe, hand-written or from card_builder_get_card_template, into config for create/update) and 'Not for' clauses (hand-crafted low-level DocumentData, template-driven one-shot creation via card_builder_make_template_card). Alternatives and exclusions are fully spelled out.

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