Skip to main content
Glama

test_config

Validates your configuration and API connectivity to ensure your media automation setup works correctly.

Instructions

Test the current configuration and API connectivity.

Returns: Configuration status and basic connectivity tests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The test_config MCP tool handler function that tests configuration and API connectivity for Radarr and Sonarr. Returns a dict with config status (URLs, API key presence) and connectivity test results.
    @mcp.tool
    async def test_config() -> dict[str, Any]:
        """
        Test the current configuration and API connectivity.
        
        Returns:
            Configuration status and basic connectivity tests
        """
        logger.info("Testing configuration...")
        
        if not config:
            return {"error": "No configuration loaded"}
        
        status = {
            "config_loaded": True,
            "radarr_url": config.radarr_url,
            "sonarr_url": config.sonarr_url,
            "radarr_api_key_set": bool(config.radarr_api_key),
            "sonarr_api_key_set": bool(config.sonarr_api_key),
            "quality_profile_id": config.quality_profile_id,
            "radarr_root_folder": config.radarr_root_folder,
            "sonarr_root_folder": config.sonarr_root_folder
        }
        
        async with MediaServerAPI(config) as api:
            if config.radarr_api_key:
                radarr_status = await api.check_radarr_status()
                status["radarr_connectivity"] = radarr_status["status"]
                if radarr_status["status"] == "connected":
                    status["radarr_version"] = radarr_status["data"].get("version")
                else:
                    status["radarr_error"] = radarr_status["message"]
            else:
                status["radarr_connectivity"] = "no_api_key"
    
            if config.sonarr_api_key:
                sonarr_status = await api.check_sonarr_status()
                status["sonarr_connectivity"] = sonarr_status["status"]
                if sonarr_status["status"] == "connected":
                    status["sonarr_version"] = sonarr_status["data"].get("version")
                else:
                    status["sonarr_error"] = sonarr_status["message"]
            else:
                status["sonarr_connectivity"] = "no_api_key"
    
        return status
  • Helper methods check_radarr_status and check_sonarr_status on MediaServerAPI class, used by test_config to verify API connectivity by calling /api/v3/system/status endpoints.
    async def check_radarr_status(self) -> dict[str, Any]:
        """Check Radarr server status"""
        url = f"{self.config.radarr_url}/api/v3/system/status"
        headers = {"X-Api-Key": self.config.radarr_api_key}
    
        try:
            response = await self.client.get(url, headers=headers)
            response.raise_for_status()
            return {"status": "connected", "data": response.json()}
        except Exception as e:
            return {"status": "error", "message": str(e)}
    
    async def check_sonarr_status(self) -> dict[str, Any]:
        """Check Sonarr server status"""
        url = f"{self.config.sonarr_url}/api/v3/system/status"
        headers = {"X-Api-Key": self.config.sonarr_api_key}
    
        try:
            response = await self.client.get(url, headers=headers)
            response.raise_for_status()
            return {"status": "connected", "data": response.json()}
        except Exception as e:
            return {"status": "error", "message": str(e)}
  • ServerConfig dataclass defining the configuration schema (URLs, API keys, quality profile, root folders) that test_config inspects and reports on.
    @dataclass
    class ServerConfig:
        radarr_url: str
        radarr_api_key: str
        sonarr_url: str
        sonarr_api_key: str
        quality_profile_id: int = 1
        radarr_root_folder: str | None = None
        sonarr_root_folder: str | None = None
    
        def __post_init__(self) -> None:
            self.radarr_url = self.radarr_url.rstrip("/")
            self.sonarr_url = self.sonarr_url.rstrip("/")
  • The @mcp.tool decorator on line 452 registers test_config as an MCP tool.
    @mcp.tool
  • Unit test for test_config that monkeypatches check_radarr_status and check_sonarr_status to verify the tool checks both services and returns correct results.
    @pytest.mark.asyncio
    async def test_test_config_checks_both_services(monkeypatch: pytest.MonkeyPatch) -> None:
        async def fake_check_radarr(self: MediaServerAPI) -> dict[str, object]:
            return {"status": "connected", "data": {"version": "5.0.0"}}
    
        async def fake_check_sonarr(self: MediaServerAPI) -> dict[str, object]:
            return {"status": "error", "message": "connection refused"}
    
        monkeypatch.setattr(MediaServerAPI, "check_radarr_status", fake_check_radarr)
        monkeypatch.setattr(MediaServerAPI, "check_sonarr_status", fake_check_sonarr)
    
        result = await server_main.test_config()
    
        assert result["radarr_connectivity"] == "connected"
        assert result["radarr_version"] == "5.0.0"
        assert result["sonarr_connectivity"] == "error"
        assert result["sonarr_error"] == "connection refused"
Behavior3/5

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

With no annotations, the description should disclose behavioral traits. It mentions returns (configuration status and connectivity tests) but omits side effects, auth requirements, or safety implications. Since it's a test tool, it likely has no side effects, but this is not stated.

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 concise with two sentences, front-loading the purpose. No unnecessary words. Every part provides value.

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

Completeness5/5

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

Given the tool's simplicity (no parameters, no annotations, but has output schema), the description adequately covers its purpose and return value. Complete for its complexity.

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?

There are no parameters, so the description does not need to add parameter semantics. Schema coverage is 100%. The baseline for 0 parameters is 4, and no extra info is required.

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 name 'test_config' and description 'Test the current configuration and API connectivity' clearly specify the tool's function. It is distinct from siblings like 'add_movie_by_id' and 'get_server_status', which have different purposes.

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

Usage Guidelines3/5

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

The description implies the tool is for testing configuration and connectivity, but does not explicitly state when to use it versus alternatives or when not to use it. No exclusions or alternative tool references are provided.

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/omniwaifu/arr-assistant-mcp'

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