Fix dependency parsing for dict format in tool configs
- Normalize dependencies in Tool.from_dict() to handle both string and dict formats
- Dict format: {name: "tts", version: "*"} → extracts just the name for Tool.dependencies
- Fixes "unhashable type: dict" error in check_dependencies()
This allows tools to declare dependencies with version constraints in config.yaml:
dependencies:
- name: tts
version: "*"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
93797a450a
commit
a36c2db05c
|
|
@ -220,6 +220,16 @@ class Tool:
|
|||
if "source" in data:
|
||||
source = ToolSource.from_dict(data["source"])
|
||||
|
||||
# Normalize dependencies - can be strings or dicts with name/version
|
||||
raw_deps = data.get("dependencies", [])
|
||||
dependencies = []
|
||||
for dep in raw_deps:
|
||||
if isinstance(dep, str):
|
||||
dependencies.append(dep)
|
||||
elif isinstance(dep, dict) and "name" in dep:
|
||||
dependencies.append(dep["name"])
|
||||
# Skip invalid entries
|
||||
|
||||
return cls(
|
||||
name=data["name"],
|
||||
description=data.get("description", ""),
|
||||
|
|
@ -227,7 +237,7 @@ class Tool:
|
|||
arguments=arguments,
|
||||
steps=steps,
|
||||
output=data.get("output", "{input}"),
|
||||
dependencies=data.get("dependencies", []),
|
||||
dependencies=dependencies,
|
||||
source=source,
|
||||
version=data.get("version", ""),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue