File size: 1,204 Bytes
9dbb7e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
MCP Tool: get_chain_schema
Get the complete parameter schema and usage guide for a specified chain/injector type.
"""

from .common import _load_yaml, _CHAIN_FEATURES_PATH
from .error_schema import make_validation_error, make_not_found_error


def handle_get_chain_schema(chain_type: str) -> dict:
    """Get the complete parameter schema and usage guide for a specified chain/injector type."""
    if not chain_type:
        return make_validation_error(
            "Parameter 'chain_type' is required.",
            missing_fields=["chain_type"],
        )

    chain_features = _load_yaml(_CHAIN_FEATURES_PATH)

    if chain_type not in chain_features:
        return make_not_found_error("chain_type", chain_type)

    chain_data = chain_features[chain_type]
    return {
        "feature_name": chain_type,
        "display_name": chain_data.get("display_name", chain_type),
        "description": chain_data.get("description", ""),
        "supported_tasks": chain_data.get("supported_tasks", []),
        "max_count": chain_data.get("max_count", 1),
        "usage_guideline": chain_data.get("usage_guideline", ""),
        "parameters_schema": chain_data.get("parameters_schema", {}),
    }