Skip to main content
Glama

loxone_test_connection

Verify connectivity to a Loxone Miniserver by testing authentication and network access with provided credentials or environment variables.

Instructions

Test connection to Loxone Miniserver.

Args: host: Loxone Miniserver host/IP address (uses LOXONE_HOST env var if not provided) username: Loxone username (uses LOXONE_USERNAME env var if not provided) password: Loxone password (uses LOXONE_PASSWORD env var if not provided) port: Loxone port (uses LOXONE_PORT env var or default: 80)

Returns: Connection test result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostNo
usernameNo
passwordNo
portNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function `loxone_test_connection` which performs the connection test to the Loxone Miniserver.
    async def loxone_test_connection(
        host: str | None = None,
        username: str | None = None,
        password: str | None = None,
        port: int = 80,
    ) -> dict[str, Any]:
        """
        Test connection to Loxone Miniserver.
    
        Args:
            host: Loxone Miniserver host/IP address (uses LOXONE_HOST env var if not provided)
            username: Loxone username (uses LOXONE_USERNAME env var if not provided)
            password: Loxone password (uses LOXONE_PASSWORD env var if not provided)
            port: Loxone port (uses LOXONE_PORT env var or default: 80)
    
        Returns:
            Connection test result
        """
    
        try:
            # Import here to avoid import issues when running as script
            import sys
            from pathlib import Path
    
            # Add the parent directory to path for imports
            parent_dir = Path(__file__).parent
            if str(parent_dir) not in sys.path:
                sys.path.insert(0, str(parent_dir))
    
            from .config import LoxoneConfig
            from .loxone_client import LoxoneClient
    
            # Use environment variables as primary source, parameters as override
            try:
                if not all([host, username, password]):
                    # Load from environment
                    env_config = LoxoneConfig.from_env()
                    host = host or env_config.host
                    username = username or env_config.username
                    password = password or env_config.password
                    port = port if port != 80 else env_config.port
            except ValueError as e:
                return {
                    "success": False,
                    "error": f"Configuration error: {e}",
                    "error_code": "MISSING_PARAMETERS",
                }
    
            logger.info(f"Testing connection to {host}:{port}")
    
            # Create configuration
            config = LoxoneConfig(host=host, username=username, password=password, port=port)
    
            # Create and test client connection
            client = LoxoneClient(config)
    
            logger.info(f"Connecting to Loxone Miniserver at {host}:{port}...")
            connected = await client.connect()
    
            if not connected:
                return {
                    "success": False,
                    "error": f"Failed to connect to Loxone Miniserver at {host}:{port}",
                    "error_code": "CONNECTION_FAILED",
                    "host": host,
                    "port": port,
                }
    
            try:
                # Test basic functionality
                logger.info("Testing structure retrieval...")
                structure = await client.get_structure()
    
                structure_info = {
                    "rooms": len(structure.get("rooms", {})),
                    "controls": len(structure.get("controls", {})),
                    "categories": len(structure.get("categories", {})),
                }
    
                logger.info(f"Connection test successful: {structure_info}")
    
                return {
                    "success": True,
                    "message": "Connection successful",
                    "host": host,
                    "port": port,
                    "structure_info": structure_info,
                }
    
            finally:
                # Always disconnect
                await client.disconnect()
    
        except Exception as e:
            logger.error(f"Connection test failed: {e}", exc_info=True)
            return {
  • Tool registration for `loxone_test_connection` using `@mcp.tool()` decorator.
    @mcp.tool()
    async def loxone_test_connection(
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 of behavioral disclosure. While it mentions a return value exists, it fails to clarify whether the operation is read-only, whether it creates persistent sessions, timeout behavior, or what specific aspects of the connection are validated (network vs authentication).

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 with clear Purpose/Args/Returns sections and minimal filler. The Args section contains slight repetition ('uses X env var if not provided'), but every sentence provides necessary configuration information.

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 lack of annotations, the description adequately covers all parameters through the Args block and acknowledges the existence of a return value (output schema is present). However, it omits behavioral context (safety profile, side effects, error handling) that would be necessary for a complete understanding of a network authentication tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the Args section fully compensates by providing semantic meaning for all four parameters (host, username, password, port), including data types (host/IP), domain context (Loxone), and fallback mechanisms (environment variables with specific naming conventions).

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 opening sentence 'Test connection to Loxone Miniserver' provides a clear verb and resource. It implicitly distinguishes from siblings (loxone_get_device_state, loxone_list_devices) by describing a diagnostic connectivity operation versus data retrieval, though it does not explicitly contrast with them.

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 documents parameter sources (environment variables vs arguments) but provides no guidance on when to use this tool versus alternatives, nor does it mention prerequisites such as verifying connectivity before attempting device operations with sibling tools.

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/BernhardRode/loxone-mcp-server'

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