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:
rob 2026-01-16 20:22:26 -04:00
parent 19c1cf086f
commit 23c42faf75
1 changed files with 3 additions and 8 deletions

View File

@ -118,14 +118,9 @@ def get_tool_publish_state(tool_name: str) -> Tuple[str, Optional[str]]:
if not registry_hash:
return ("local", None)
# Compute hash the same way as publish: load Tool object and use to_dict()
# This ensures we compare the same normalized representation
tool = load_tool(tool_name)
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)
# Compute hash from raw config, same as server does during publish
# Don't use to_dict() as it may add/remove fields (e.g., empty arguments: [])
current_hash = compute_config_hash(config)
if current_hash != registry_hash:
return ("modified", registry_hash)