MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / load_submodule_tools_for_yaml

Function load_submodule_tools_for_yaml

src/harness/submodules/loader.py:159–189  ·  view source on GitHub ↗

Load all submodule tools defined in a YAML file. Returns: Tuple of (tools list, registry dict mapping function name to spec)

(
    yaml_data: Dict[str, Any],
    yaml_file_path: str,
)

Source from the content-addressed store, hash-verified

157
158
159def load_submodule_tools_for_yaml(
160 yaml_data: Dict[str, Any],
161 yaml_file_path: str,
162) -> Tuple[List[Dict[str, Any]], Dict[str, SubmoduleFunctionSpec]]:
163 """
164 Load all submodule tools defined in a YAML file.
165
166 Returns:
167 Tuple of (tools list, registry dict mapping function name to spec)
168 """
169 submodules = normalize_submodule_declarations(yaml_data, yaml_file_path)
170 if not submodules:
171 return [], {}
172
173 tools: List[Dict[str, Any]] = []
174 registry: Dict[str, SubmoduleFunctionSpec] = {}
175 parser = YAMLTaskParser()
176
177 for entry in submodules:
178 declared_name = entry.get("name")
179 module_path = entry["path"]
180 module_yaml = parser.load_task(module_path)
181 spec = parse_submodule_function_declaration(
182 module_yaml, module_path, declared_name=declared_name
183 )
184 if spec.name in registry:
185 raise ValueError(f"Duplicate submodule function name: {spec.name}")
186 registry[spec.name] = spec
187 tools.append(build_submodule_tool(spec))
188
189 return tools, registry

Callers 7

executeMethod · 0.90
test_no_submodulesMethod · 0.90
runMethod · 0.85

Calls 6

load_taskMethod · 0.95
build_submodule_toolFunction · 0.85
getMethod · 0.80
YAMLTaskParserClass · 0.50