Skip to main content
Glama

system_overview

Get a comprehensive overview of your Home Assistant system structure, including entity counts, domain distributions, and area groupings to understand your smart home setup.

Instructions

Get a comprehensive overview of the entire Home Assistant system

Returns: A dictionary containing: - total_entities: Total count of all entities - domains: Dictionary of domains with their entity counts and state distributions - domain_samples: Representative sample entities for each domain (2-3 per domain) - domain_attributes: Common attributes for each domain - area_distribution: Entities grouped by area (if available)

Examples: Returns domain counts, sample entities, and common attributes Best Practices: - Use this as the first call when exploring an unfamiliar Home Assistant instance - Perfect for building context about the structure of the smart home - After getting an overview, use domain_summary_tool to dig deeper into specific domains

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'system_overview' tool, decorated with @mcp.tool() for registration and @async_handler for logging. It executes the tool logic by calling the helper function get_system_overview().
    @mcp.tool()
    @async_handler("system_overview")
    async def system_overview() -> Dict[str, Any]:
        """
        Get a comprehensive overview of the entire Home Assistant system
        
        Returns:
            A dictionary containing:
            - total_entities: Total count of all entities
            - domains: Dictionary of domains with their entity counts and state distributions
            - domain_samples: Representative sample entities for each domain (2-3 per domain)
            - domain_attributes: Common attributes for each domain
            - area_distribution: Entities grouped by area (if available)
            
        Examples:
            Returns domain counts, sample entities, and common attributes
        Best Practices:
            - Use this as the first call when exploring an unfamiliar Home Assistant instance
            - Perfect for building context about the structure of the smart home
            - After getting an overview, use domain_summary_tool to dig deeper into specific domains
        """
        logger.info("Generating complete system overview")
        return await get_system_overview()
  • Core helper function that implements the system overview logic. Fetches all entity states from Home Assistant API, applies lean filtering, groups by domain and area, computes statistics including entity counts, state distributions, representative samples, common attributes, and returns a structured overview dictionary.
    @handle_api_errors
    async def get_system_overview() -> Dict[str, Any]:
        """
        Get a comprehensive overview of the entire Home Assistant system
        
        Returns:
            A dictionary containing:
            - total_entities: Total count of all entities
            - domains: Dictionary of domains with their entity counts and state distributions
            - domain_samples: Representative sample entities for each domain (2-3 per domain)
            - domain_attributes: Common attributes for each domain
            - area_distribution: Entities grouped by area (if available)
        """
        try:
            # Get ALL entities with minimal fields for efficiency
            # We retrieve all entities since API calls don't consume tokens, only responses do
            client = await get_client()
            response = await client.get(f"{HA_URL}/api/states", headers=get_ha_headers())
            response.raise_for_status()
            all_entities_raw = response.json()
            
            # Apply lean formatting to reduce token usage in the response
            all_entities = []
            for entity in all_entities_raw:
                domain = entity["entity_id"].split(".")[0]
                
                # Start with basic lean fields
                lean_fields = ["entity_id", "state", "attr.friendly_name"]
                
                # Add domain-specific important attributes
                if domain in DOMAIN_IMPORTANT_ATTRIBUTES:
                    for attr in DOMAIN_IMPORTANT_ATTRIBUTES[domain]:
                        lean_fields.append(f"attr.{attr}")
                
                # Filter and add to result
                all_entities.append(filter_fields(entity, lean_fields))
            
            # Initialize overview structure
            overview = {
                "total_entities": len(all_entities),
                "domains": {},
                "domain_samples": {},
                "domain_attributes": {},
                "area_distribution": {}
            }
            
            # Group entities by domain
            domain_entities = {}
            for entity in all_entities:
                domain = entity["entity_id"].split(".")[0]
                if domain not in domain_entities:
                    domain_entities[domain] = []
                domain_entities[domain].append(entity)
            
            # Process each domain
            for domain, entities in domain_entities.items():
                # Count entities in this domain
                count = len(entities)
                
                # Collect state distribution
                state_distribution = {}
                for entity in entities:
                    state = entity.get("state", "unknown")
                    if state not in state_distribution:
                        state_distribution[state] = 0
                    state_distribution[state] += 1
                
                # Store domain information
                overview["domains"][domain] = {
                    "count": count,
                    "states": state_distribution
                }
                
                # Select representative samples (2-3 per domain)
                sample_limit = min(3, count)
                samples = []
                for i in range(sample_limit):
                    entity = entities[i]
                    samples.append({
                        "entity_id": entity["entity_id"],
                        "state": entity.get("state", "unknown"),
                        "friendly_name": entity.get("attributes", {}).get("friendly_name", entity["entity_id"])
                    })
                overview["domain_samples"][domain] = samples
                
                # Collect common attributes for this domain
                attribute_counts = {}
                for entity in entities:
                    for attr in entity.get("attributes", {}):
                        if attr not in attribute_counts:
                            attribute_counts[attr] = 0
                        attribute_counts[attr] += 1
                
                # Get top 5 most common attributes for this domain
                common_attributes = sorted(attribute_counts.items(), key=lambda x: x[1], reverse=True)[:5]
                overview["domain_attributes"][domain] = [attr for attr, count in common_attributes]
                
                # Group by area if available
                for entity in entities:
                    area_id = entity.get("attributes", {}).get("area_id", "Unknown")
                    area_name = entity.get("attributes", {}).get("area_name", area_id)
                    
                    if area_name not in overview["area_distribution"]:
                        overview["area_distribution"][area_name] = {}
                    
                    if domain not in overview["area_distribution"][area_name]:
                        overview["area_distribution"][area_name][domain] = 0
                        
                    overview["area_distribution"][area_name][domain] += 1
            
            # Add summary information
            overview["domain_count"] = len(domain_entities)
            overview["most_common_domains"] = sorted(
                [(domain, len(entities)) for domain, entities in domain_entities.items()],
                key=lambda x: x[1],
                reverse=True
            )[:5]
            
            return overview
        except Exception as e:
            logger.error(f"Error generating system overview: {str(e)}")
            return {"error": f"Error generating system overview: {str(e)}"}
Behavior4/5

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

With no annotations provided, the description carries full burden. It discloses the tool's behavior by detailing the return structure (dictionary with 5 specific components), provides examples of what it returns, and mentions it's for 'exploring an unfamiliar Home Assistant instance.' However, it doesn't mention performance characteristics, potential data size, or error conditions.

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?

Well-structured with clear sections: purpose statement, return format breakdown, examples, and best practices. Every sentence adds value - no repetition or fluff. The information is front-loaded with the core purpose first, followed by details.

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

Completeness4/5

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

For a parameterless tool with no output schema, the description provides excellent context: clear purpose, detailed return structure, usage guidance, and sibling tool relationships. The only minor gap is lack of explicit mention about performance or limitations for what could be a data-intensive operation.

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 with 100% schema description coverage. The description appropriately doesn't waste space discussing non-existent parameters. It focuses instead on what the tool does and returns, which is the correct approach for a parameterless tool.

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 description explicitly states 'Get a comprehensive overview of the entire Home Assistant system' - a clear verb ('Get') and resource ('overview of the entire Home Assistant system'). It distinguishes from siblings by specifying this provides a system-wide overview rather than domain-specific details (contrasting with domain_summary_tool) or entity-level operations (contrasting with get_entity, entity_action).

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?

The 'Best Practices' section provides explicit guidance: 'Use this as the first call when exploring an unfamiliar Home Assistant instance' and 'After getting an overview, use domain_summary_tool to dig deeper into specific domains.' This clearly indicates when to use this tool versus alternatives, with specific sibling tool named for follow-up actions.

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