Skip to main content
Glama

Add Lovelace resource

dashboards_add_dashboard_resource

Registers a custom JS or CSS resource so it loads on every Lovelace dashboard page. Use it to make a custom card, theme, or script available across all dashboards.

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/ (incl. the Marketplace's /local/community/), /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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "url": "<url>"
    },
    "name": "dashboards_add_dashboard_resource"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesResource URL, e.g. '/local/my-card.js' or '/local/community/mini-graph-card/mini-graph-card-bundle.js' (Marketplace, HA 2026.11+; '/hacsfiles/...' with HACS before).
resource_typeNoResource kind: 'module' (ES module JS), 'js' (legacy script), or 'css'. Defaults to 'module'.module

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.28.1
    • changedInput schema / properties / url / description
      Previous value: -"Resource URL, e.g. '/local/my-card.js' or '/hacsfiles/mini-graph-card/mini-graph-card-bundle.js'."New value: +"Resource URL, e.g. '/local/my-card.js' or '/local/community/mini-graph-card/mini-graph-card-bundle.js' (Marketplace, HA 2026.11+; '/hacsfiles/...' with HACS before)."
  2. 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'."
  3. Addedv0.18.1

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, idempotentHint=false and destructiveHint=false; the description adds the mechanism behind non-idempotency (a server-generated id, so repeating the call creates a second distinct entry) and clarifies the tool only stores the URL string and never fetches it. That is real value beyond annotations, though it does not cover permissions or how to undo/remove an added resource.

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 purpose, then labelled blocks (Use when / Not for / Returns / Errors) make it skimmable. Slightly over-written: the /local/community/ and Marketplace path detail repeats the `url` schema description, and the Returns line duplicates the output schema.

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 2-parameter mutation tool with an output schema and full annotations, nothing an agent needs is missing: purpose, alternative, duplicate-registration behavior, error condition, and no-fetch semantics are all covered.

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 baseline is 3, but the description adds meaning the schema lacks: that `url` is merely stored and later fetched by the browser from /local/, /hacsfiles/ or a CDN, and it surfaces the exact validation constraint on `resource_type` ('module', 'js', or 'css') via the error example.

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?

The opening sentence names a specific verb (register) and resource (custom JS or CSS Lovelace resource) plus its scope (loads on every dashboard page). The 'Not for' line explicitly separates it from the sibling dashboards_update_dashboard_resource, so an agent can route correctly without reading the 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 — use dashboards_update_dashboard_resource'. Both the positive trigger and the exclusion with a named alternative are present.

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