Skip to main content
Glama

list_automations

Retrieve all configured Home Assistant automations with their IDs, entity IDs, states, and friendly names to monitor and manage smart home automation tasks.

Instructions

Get a list of all automations from Home Assistant

This function retrieves all automations configured in Home Assistant, including their IDs, entity IDs, state, and display names.

Returns: A list of automation dictionaries, each containing id, entity_id, state, and alias (friendly name) fields.

Examples: Returns all automation objects with state and friendly names

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'list_automations' MCP tool. Registered via @mcp.tool(). Fetches automations using get_automations() helper and handles errors gracefully.
    @async_handler("list_automations")
    async def list_automations() -> List[Dict[str, Any]]:
        """
        Get a list of all automations from Home Assistant
        
        This function retrieves all automations configured in Home Assistant,
        including their IDs, entity IDs, state, and display names.
        
        Returns:
            A list of automation dictionaries, each containing id, entity_id, 
            state, and alias (friendly name) fields.
            
        Examples:
            Returns all automation objects with state and friendly names
        
        """
        logger.info("Getting all automations")
        try:
            # Get automations will now return data from states API, which is more reliable
            automations = await get_automations()
            
            # Handle error responses that might still occur
            if isinstance(automations, dict) and "error" in automations:
                logger.warning(f"Error getting automations: {automations['error']}")
                return []
                
            # Handle case where response is a list with error
            if isinstance(automations, list) and len(automations) == 1 and isinstance(automations[0], dict) and "error" in automations[0]:
                logger.warning(f"Error getting automations: {automations[0]['error']}")
                return []
                
            return automations
        except Exception as e:
            logger.error(f"Error in list_automations: {str(e)}")
            return []
  • Helper function that retrieves automation entities using get_entities('automation'), extracts relevant fields like id, entity_id, state, alias, and last_triggered.
    async def get_automations() -> List[Dict[str, Any]]:
        """Get a list of all automations from Home Assistant"""
        # Reuse the get_entities function with domain filtering
        automation_entities = await get_entities(domain="automation")
        
        # Check if we got an error response
        if isinstance(automation_entities, dict) and "error" in automation_entities:
            return automation_entities  # Just pass through the error
        
        # Process automation entities
        result = []
        try:
            for entity in automation_entities:
                # Extract relevant information
                automation_info = {
                    "id": entity["entity_id"].split(".")[1],
                    "entity_id": entity["entity_id"],
                    "state": entity["state"],
                    "alias": entity["attributes"].get("friendly_name", entity["entity_id"]),
                }
                
                # Add any additional attributes that might be useful
                if "last_triggered" in entity["attributes"]:
                    automation_info["last_triggered"] = entity["attributes"]["last_triggered"]
                
                result.append(automation_info)
        except (TypeError, KeyError) as e:
            # Handle errors in processing the entities
            return {"error": f"Error processing automation entities: {str(e)}"}
            
        return result
Behavior3/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 discloses that the tool retrieves data (a read operation) and describes the return format (a list of dictionaries with specific fields). However, it lacks details on potential behavioral traits such as rate limits, authentication needs, or error handling, which are important for a tool with no annotations.

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?

The description is well-structured and appropriately sized. It starts with a clear purpose statement, adds details about what is retrieved, specifies the return format, and includes an example note. There is minimal redundancy, and each sentence adds value, though it could be slightly more concise by integrating the 'Returns' section more seamlessly.

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

Completeness3/5

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

Given the tool's complexity (simple read operation with 0 parameters) and the absence of both annotations and an output schema, the description is moderately complete. It explains the purpose and return format, but lacks context on when to use it versus siblings, and does not cover potential limitations or behavioral aspects fully, making it adequate but with gaps.

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?

The tool has 0 parameters, and the schema description coverage is 100% (as there are no parameters to describe). According to the rules, for 0 parameters, the baseline score is 4. The description does not need to add parameter semantics, and it appropriately focuses on the tool's purpose and output.

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 tool's purpose: 'Get a list of all automations from Home Assistant' and 'retrieves all automations configured in Home Assistant'. It specifies the verb ('get', 'retrieves') and resource ('automations'), but does not explicitly differentiate it from sibling tools like 'list_entities' or 'search_entities_tool', which is why it scores a 4 instead of a 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It does not mention sibling tools like 'list_entities' or 'search_entities_tool', nor does it specify any context or exclusions for usage. The only implied usage is retrieving automations, but no explicit guidelines are given.

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/voska/hass-mcp'

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