Fix hash comparison in get_tool_publish_state
Use raw config for hash comparison instead of to_dict(), which was adding fields like 'arguments: []' that weren't in the original config. This caused tools to show as "modified" when they weren't. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
19c1cf086f
commit
23c42faf75
|
|
@ -118,14 +118,9 @@ def get_tool_publish_state(tool_name: str) -> Tuple[str, Optional[str]]:
|
||||||
if not registry_hash:
|
if not registry_hash:
|
||||||
return ("local", None)
|
return ("local", None)
|
||||||
|
|
||||||
# Compute hash the same way as publish: load Tool object and use to_dict()
|
# Compute hash from raw config, same as server does during publish
|
||||||
# This ensures we compare the same normalized representation
|
# Don't use to_dict() as it may add/remove fields (e.g., empty arguments: [])
|
||||||
tool = load_tool(tool_name)
|
current_hash = compute_config_hash(config)
|
||||||
if tool:
|
|
||||||
current_hash = compute_config_hash(tool.to_dict())
|
|
||||||
else:
|
|
||||||
# Fallback to raw config if Tool can't be loaded
|
|
||||||
current_hash = compute_config_hash(config)
|
|
||||||
|
|
||||||
if current_hash != registry_hash:
|
if current_hash != registry_hash:
|
||||||
return ("modified", registry_hash)
|
return ("modified", registry_hash)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue