Skip to main content
Glama

Add Lovelace resource

dashboards_add_dashboard_resource

Add a custom JS or CSS resource to load on every Lovelace dashboard page, making custom cards, themes, or scripts available globally.

Instructions

Register a custom JS or CSS resource that loads on every Lovelace dashboard page.

Sends url/resource_type to lovelace/resources/create, which stores a new resource entry with a server-generated id — repeating this call registers a second, distinct resource rather than updating one. The tool itself only stores the URL string; it never fetches url — the browser loads it later, from /local/, /hacsfiles/, or any external CDN the URL names.

Use when: registering a custom card, theme, or script so it becomes available on every dashboard. Not for: changing an existing resource's URL/type — use dashboards_update_dashboard_resource. Returns: {"status": "added", "url": ..., "resource_type": ..., "result": ...} on success. Errors: {"error": "resource_type must be 'module', 'js', or 'css'"} when resource_type is anything else.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesResource URL, e.g. '/local/my-card.js' or '/hacsfiles/mini-graph-card/mini-graph-card-bundle.js'.
resource_typeNoResource kind: 'module' (ES module JS), 'js' (legacy script), or 'css'. Defaults to 'module'.module

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.25.1
    • changedInput schema / properties / resource_type / description
      Previous value: -"'module' (default, ES module JS), 'js' (legacy script), or 'css'."New value: +"Resource kind: 'module' (ES module JS), 'js' (legacy script), or 'css'. Defaults to 'module'."
  2. Addedv0.18.1

TDQS

A4.8/5.0
Behavior5/5

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

Adds substantial context beyond annotations: it discloses that the call is non-idempotent (repeating registers a second distinct resource), that the server generates the id, and that the URL is only stored, never fetched, with the browser loading it later from /local/, /hacsfiles/, or a CDN. It also documents the error payload for an invalid resource_type.

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 and clearly segmented with Use when / Not for / Returns / Errors labels, so an agent can scan it. However, the explicit 'Returns:' block restates what the output schema already provides, which is mild redundancy.

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?

Given a mutation tool with an output schema and full annotation coverage, the description supplies exactly the missing pieces: non-idempotency, side-effect scope, the not-for alternative, and the failure mode. Nothing an agent needs to call it correctly is absent.

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 both parameters are already documented, giving a baseline of 3. The description still adds meaning by clarifying that `url` is an opaque string never fetched by the tool, and by restating the enum constraint on `resource_type` for callers who don't read 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 resource ('Register a custom JS or CSS resource that loads on every Lovelace dashboard page') and names the sibling it is not, `dashboards_update_dashboard_resource`. An agent can distinguish it from the update/remove siblings 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' (registering a custom card, theme, or script) and 'Not for' (changing an existing resource's URL/type) clauses, with the alternative tool named by exact identifier. Nothing is left to inference.

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