Add path attribute to Tool class for config file tracking
The Tool dataclass now has a path field that points to the config.yaml file it was loaded from. This is set by load_tool() and enables the publish dialog to save the registry_hash back to the local config. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4b1f3cee52
commit
62a4b4a2da
|
|
@ -198,6 +198,7 @@ class Tool:
|
||||||
dependencies: List[str] = field(default_factory=list) # Required tools for meta-tools
|
dependencies: List[str] = field(default_factory=list) # Required tools for meta-tools
|
||||||
source: Optional[ToolSource] = None # Attribution for imported/external tools
|
source: Optional[ToolSource] = None # Attribution for imported/external tools
|
||||||
version: str = "" # Tool version
|
version: str = "" # Tool version
|
||||||
|
path: Optional[Path] = None # Path to config.yaml (set by load_tool)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls, data: dict) -> "Tool":
|
def from_dict(cls, data: dict) -> "Tool":
|
||||||
|
|
@ -331,7 +332,9 @@ def load_tool(name: str) -> Optional[Tool]:
|
||||||
"output": "{response}" if steps else "{input}"
|
"output": "{response}" if steps else "{input}"
|
||||||
}
|
}
|
||||||
|
|
||||||
return Tool.from_dict(data)
|
tool = Tool.from_dict(data)
|
||||||
|
tool.path = config_path
|
||||||
|
return tool
|
||||||
except yaml.YAMLError as e:
|
except yaml.YAMLError as e:
|
||||||
import sys
|
import sys
|
||||||
print(f"Error loading tool '{name}': YAML syntax error", file=sys.stderr)
|
print(f"Error loading tool '{name}': YAML syntax error", file=sys.stderr)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue