Skip to main content
Glama
diverdown1964

Home Assistant MCP Server

list_entities

Retrieve all smart home devices and sensors from Home Assistant, with optional filtering by device type like lights or switches.

Instructions

List all Home Assistant entities (lights, switches, sensors, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainNoFilter by domain (e.g., 'light', 'switch', 'sensor'). Optional.

Implementation Reference

  • Handler for the 'list_entities' tool. Fetches all Home Assistant entities using haClient.getStates(), optionally filters by domain from input arguments, maps to a simplified object (entity_id, state, friendly_name), stringifies as JSON, and returns in the tool response content.
    case "list_entities": {
      const entities = await haClient.getStates();
      const filtered = args?.domain
        ? entities.filter((e) => e.entity_id.startsWith(`${args.domain}.`))
        : entities;
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              filtered.map((e) => ({
                entity_id: e.entity_id,
                state: e.state,
                friendly_name: e.attributes.friendly_name,
              })),
              null,
              2
            ),
          },
        ],
      };
    }
  • src/index.ts:101-112 (registration)
    Registration of the 'list_entities' tool in the ListToolsRequestHandler response. Includes the tool name, description, and input schema for optional domain filter.
      name: "list_entities",
      description: "List all Home Assistant entities (lights, switches, sensors, etc.)",
      inputSchema: {
        type: "object",
        properties: {
          domain: {
            type: "string",
            description: "Filter by domain (e.g., 'light', 'switch', 'sensor'). Optional.",
          },
        },
      },
    },
  • Helper method in HomeAssistantClient class that fetches the list of all entity states from the Home Assistant API endpoint '/api/states'.
    async getStates(): Promise<HAEntity[]> {
      return this.fetch("states");
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states what the tool does but doesn't disclose behavioral traits such as whether this is a read-only operation (implied by 'List'), potential rate limits, authentication requirements, pagination behavior, or what the return format looks like. For a tool with no annotation coverage, this is a significant gap.

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?

The description is a single, efficient sentence that front-loads the purpose ('List all Home Assistant entities') and includes helpful examples ('lights, switches, sensors, etc.'). There is zero wasted text, making it appropriately sized and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It lacks information on behavioral aspects (e.g., safety, performance) and output format, which are crucial for an AI agent to use the tool effectively. The description covers the basic purpose but doesn't compensate for the missing structured data.

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?

The input schema has 100% description coverage, with one optional parameter 'domain' documented as filtering by domain. The description doesn't add any parameter details beyond what the schema provides (e.g., it doesn't explain the filtering further or provide additional context). With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all Home Assistant entities') with examples of entity types ('lights, switches, sensors, etc.'). It distinguishes the tool from siblings like 'get_entity_state' (which gets state of a single entity) and 'list_services' (which lists services rather than entities). However, it doesn't explicitly differentiate from 'call_service' beyond the resource focus.

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

Usage Guidelines3/5

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

The description implies usage for listing entities, but provides no explicit guidance on when to use this tool versus alternatives like 'get_entity_state' for single entities or 'list_services' for services. The context is clear (listing entities), but no exclusions or specific scenarios are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/diverdown1964/HomeAssistant-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server