Skip to main content
Glama
hekmon8
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);

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