Skip to main content
Glama

Compose styles from snippets

card_builder_build_styles
Read-onlyIdempotent

Merge reusable style snippets and optional overrides to assemble a block's styles or dz_styles. Use when building styles from presets instead of hand-writing.

Instructions

Compose a styles object from one or more built-in snippets plus optional overrides.

Merges each named entry from STYLE_SNIPPETS in order, then extra, at the property level — later entries override earlier ones for the same category/property; makes no call to Home Assistant.

Use when: assembling a block's styles/dz_styles from reusable presets instead of hand-writing the full envelope. Returns: {<target>: {containers: {<container>: {<category>: {<prop>: <value>, ...}, ...}}}}. Errors: {"error": "unknown_snippet", "name": ..., "known": [...]} when a name in snippet_names isn't a known snippet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
extraNoExtra ContainerStyleData ({category: {prop: {value, unit}}}) merged in last, overriding the snippets. Omit for none.
targetNoStyle target key to wrap the result under, e.g. 'block' or 'state'. Defaults to 'block'.block
containerNoResponsive container to wrap the result under: 'desktop', 'tablet', or 'mobile'. Defaults to 'desktop'.desktop
snippet_namesYesOrdered list of snippet names from card_builder_list_style_snippets to merge, e.g. ['card_padded', 'vertical_stack'].

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.25.1
    • addedInput schema / properties / container / description
      Added value: +"Responsive container to wrap the result under: 'desktop', 'tablet', or 'mobile'. Defaults to 'desktop'."
    • addedInput schema / properties / extra / description
      Added value: +"Extra ContainerStyleData ({category: {prop: {value, unit}}}) merged in last, overriding the snippets. Omit for none."
    • addedInput schema / properties / snippet_names / description
      Added value: +"Ordered list of snippet names from card_builder_list_style_snippets to merge, e.g. ['card_padded', 'vertical_stack']."
    • addedInput schema / properties / target / description
      Added value: +"Style target key to wrap the result under, e.g. 'block' or 'state'. Defaults to 'block'."
  2. Addedv0.18.1

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive/closed-world, so the safety profile is covered. The description adds genuinely new behavior: property-level merge order (later entries override earlier for the same category/property), the explicit 'makes no call to Home Assistant' guarantee, and the unknown_snippet error shape with its known list.

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-loaded with the core action, then cleanly separated Use when / Returns / Errors blocks. Every sentence carries distinct information; nothing is redundant padding.

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 pure-computation composer with full schema coverage and an output schema, the definition covers purpose, usage condition, merge semantics, and error behavior. An agent has everything needed to select and invoke it correctly; the Returns line is mildly redundant given the output schema but not harmful.

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 baseline is 3. The description goes beyond the schema by spelling out merge precedence between ordered snippet_names and the trailing extra object, which the schema only hints at, adding real semantic value on how the inputs interact.

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 (compose) and resource (a styles object from built-in snippets plus overrides), and names the underlying STYLE_SNIPPETS source. It is clearly distinguishable from sibling style tools like card_builder_get_style_snippet or card_builder_list_style_presets.

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

Usage Guidelines4/5

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

The 'Use when' clause gives concrete context — assembling a block's styles/dz_styles from reusable presets rather than hand-writing the full envelope — and points at card_builder_list_style_snippets as the source of names. It stops short of naming an explicit alternative tool to use when the condition is false, so it is clear but not fully routing.

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