Skip to main content
Glama
hekmon8

Home Assistant MCP Server

by hekmon8

list_entities

Retrieve all entities in Home Assistant to monitor and control devices. Filter by domain like light or switch to find specific entities.

Instructions

List all available entities in Home Assistant

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainNoOptional domain filter (e.g., light, switch, automation)

Implementation Reference

  • The handler function for the 'list_entities' tool. It fetches all entity states from the Home Assistant API, optionally filters by domain, maps to a simplified structure, and returns as formatted JSON text.
    private async listEntities(args: any) {
      const response = await this.haClient.get('/api/states');
      let entities = response.data;
    
      if (args.domain) {
        entities = entities.filter((entity: any) => 
          entity.entity_id.startsWith(args.domain + '.'));
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(entities.map((entity: any) => ({
              entity_id: entity.entity_id,
              state: entity.state,
              attributes: entity.attributes,
            })), null, 2),
          },
        ],
      };
    }
  • src/index.ts:103-115 (registration)
    Registration of the 'list_entities' tool in the ListToolsRequestHandler response. Includes name, description, and input schema definition.
    {
      name: 'list_entities',
      description: 'List all available entities in Home Assistant',
      inputSchema: {
        type: 'object',
        properties: {
          domain: {
            type: 'string',
            description: 'Optional domain filter (e.g., light, switch, automation)',
          },
        },
      },
    },
  • src/index.ts:128-129 (registration)
    Dispatch case in the CallToolRequestHandler switch statement that invokes the listEntities handler.
    case 'list_entities':
      return await this.listEntities(request.params.arguments);
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information on permissions needed, rate limits, pagination, return format, or whether it's safe/read-only. For a listing tool with zero annotation coverage, this leaves significant gaps.

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, clear sentence with zero wasted words. It's appropriately sized for a simple tool and front-loads the core purpose immediately.

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 for a tool that likely returns a list of entities. It doesn't explain what information is returned (e.g., entity IDs, names, states) or behavioral aspects like safety. For a listing tool in this context, more detail would be helpful.

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 the single parameter 'domain' documented as an optional filter. The description doesn't add any parameter details beyond what the schema provides, so it meets the baseline score of 3 where the schema does the heavy lifting.

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 action ('List') and resource ('all available entities in Home Assistant'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_state' which might also retrieve entity information, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'get_state' (which might retrieve specific entity states) or 'toggle_entity' (which modifies entities). The description implies a broad listing function but doesn't specify use cases or exclusions.

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/hekmon8/Homeassistant-server-mcp'

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