Skip to main content
Glama

hz_validate_config

Validate Horizon configuration files and essential environment variables to ensure proper setup before running the content aggregation pipeline.

Instructions

校验 Horizon 配置和关键环境变量。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
horizon_pathNo
config_pathNo
sourcesNo
check_envNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core implementation of the hz_validate_config tool logic, located in the HorizonPipelineService class.
    async def validate_config(
        self,
        horizon_path: str | None = None,
        config_path: str | None = None,
        sources: list[str] | None = None,
        check_env: bool = True,
    ) -> dict[str, Any]:
        ctx, selected_sources, unknown_sources = self._build_context(
            horizon_path=horizon_path,
            config_path=config_path,
            sources=sources,
        )
    
        warnings: list[str] = []
        missing_env: list[str] = []
    
        if check_env:
            required = [ctx.config.ai.api_key_env]
            for key in required:
                if not os.getenv(key):
                    missing_env.append(key)
    
            if ctx.config.sources.github and not os.getenv("GITHUB_TOKEN"):
                warnings.append("未设置 GITHUB_TOKEN,GitHub 抓取可能触发严格限流。")
    
            if getattr(ctx.config, "email", None) and ctx.config.email and ctx.config.email.enabled:
                pwd_key = ctx.config.email.password_env
                if not os.getenv(pwd_key):
                    missing_env.append(pwd_key)
    
        return {
            "horizon_path": str(ctx.horizon_path),
            "config_path": str(ctx.config_path),
            "ai": {
                "provider": ctx.config.ai.provider.value,
                "model": ctx.config.ai.model,
                "languages": list(ctx.config.ai.languages),
                "api_key_env": ctx.config.ai.api_key_env,
            },
            "filtering": {
                "ai_score_threshold": ctx.config.filtering.ai_score_threshold,
                "time_window_hours": ctx.config.filtering.time_window_hours,
            },
            "enabled_sources": get_enabled_sources(ctx.config),
            "selected_sources": selected_sources,
            "unknown_sources": unknown_sources,
            "missing_env": missing_env,
            "warnings": warnings,
        }
  • Tool registration for hz_validate_config using the @mcp.tool decorator, which maps the handler in server.py to the service method.
    @mcp.tool()
    async def hz_validate_config(
        horizon_path: str | None = None,
        config_path: str | None = None,
        sources: list[str] | None = None,
        check_env: bool = True,
    ) -> dict[str, Any]:
        """校验 Horizon 配置和关键环境变量。"""
    
        return await _run_tool(
            "hz_validate_config",
            lambda: service.validate_config(
                horizon_path=horizon_path,
                config_path=config_path,
                sources=sources,
                check_env=check_env,
            ),
        )
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 'validate' implies a read-only diagnostic operation, the description doesn't specify what happens during validation: whether it returns detailed error reports, success/failure status, what 'key environment variables' means, whether it modifies anything, or what permissions are required. For a validation tool with zero annotation coverage, this is insufficient.

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 extremely concise - a single sentence in Chinese that directly states the tool's purpose. There's no wasted language, repetition, or unnecessary elaboration. It's front-loaded with the core function and appropriately sized for what it communicates.

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 that an output schema exists, the description doesn't need to explain return values. However, for a validation tool with 4 parameters and no annotations, the description is too minimal. It doesn't provide enough context about what 'validation' entails, what constitutes valid vs invalid configuration, or how the parameters interact. The existence of an output schema helps, but the description should provide more operational context.

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

Parameters2/5

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

With 0% schema description coverage (titles only, no descriptions) and 4 parameters, the description provides no information about what the parameters mean or how they affect validation. The description mentions 'Horizon configuration' and 'environment variables' which loosely map to some parameters, but doesn't explain horizon_path vs config_path, what 'sources' refers to, or what 'check_env' controls. The description doesn't compensate for the schema's lack of parameter documentation.

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 action ('校验' meaning 'validate') and the target ('Horizon 配置和关键环境变量' meaning 'Horizon configuration and key environment variables'). It uses a specific verb and identifies the resource being validated. However, it doesn't explicitly differentiate this validation tool from its many sibling tools (like hz_get_metrics or hz_run_pipeline), which all operate on Horizon-related resources.

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. With 11 sibling tools on the server, there's no indication whether this should be used before running a pipeline, after configuration changes, or as a diagnostic tool. The description doesn't mention prerequisites, dependencies, or typical usage scenarios.

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/henry-insomniac/Horizon-mcp'

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