Skip to main content

Module tools_config_watch

Module tools_config_watch 

Source
Expand description

Detects tool-profile config changes at runtime and notifies MCP clients.

When the user changes tool_profile, tools_enabled, or disabled_tools via the dashboard, CLI, or manual config edit, the MCP client (Cursor, Claude Code, etc.) needs a notifications/tools/list_changed to re-fetch tools/list. Without this, the client serves a stale tool surface until the next IDE restart.

The watcher computes a lightweight hash of the config fields that affect tool visibility. Dispatch checks it on every tool call — a miss costs one Config::load() (already cached by content-hash) plus a u64 comparison.

Functions§

current_hash
Returns the current tools-config hash (loads config from disk).
has_changed
Checks whether the tools-relevant config has changed since the last snapshot. If it has, atomically updates the stored hash and returns true. The first call after initialization always returns false (the hash is seeded in the constructor).
tools_config_hash
Computes a stable hash of the config fields that determine the tools/list response: tool_profile, tools_enabled, disabled_tools. Two configs with the same hash produce the same advertised tool set.