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:
rob 2026-01-16 07:16:54 -04:00
parent 4b1f3cee52
commit 62a4b4a2da
1 changed files with 4 additions and 1 deletions

View File

@ -198,6 +198,7 @@ class Tool:
dependencies: List[str] = field(default_factory=list) # Required tools for meta-tools
source: Optional[ToolSource] = None # Attribution for imported/external tools
version: str = "" # Tool version
path: Optional[Path] = None # Path to config.yaml (set by load_tool)
@classmethod
def from_dict(cls, data: dict) -> "Tool":
@ -331,7 +332,9 @@ def load_tool(name: str) -> Optional[Tool]:
"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:
import sys
print(f"Error loading tool '{name}': YAML syntax error", file=sys.stderr)