list_watched
View all monitored file paths and their active subscribers to track real-time filesystem changes in the MCP Observer Server.
Instructions
List all currently monitored paths and their subscriber counts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler logic for the 'list_watched' tool within the call_tool_handler function. It checks if any paths are watched and returns a formatted list of monitored paths with subscriber counts, or a message if none are monitored.elif name == "list_watched": if not watched: return [ TextContent(type="text", text="No paths are currently being monitored") ] result_lines = [f"Currently monitoring {len(watched)} paths:"] for path, sessions in watched.items(): result_lines.append(f"- {path} ({len(sessions)} subscribers)") return [TextContent(type="text", text="\n".join(result_lines))]
- src/mcp_observer_server/server.py:80-88 (registration)Registration of the 'list_watched' tool in the @server.list_tools() handler, defining its name, description, and input schema (no required properties).Tool( name="list_watched", description="List all currently monitored paths and their subscriber counts", inputSchema={ "type": "object", "properties": {}, "additionalProperties": False, }, ),
- Input schema for the 'list_watched' tool, specifying an empty object with no properties and no additional properties allowed.inputSchema={ "type": "object", "properties": {}, "additionalProperties": False, },
- Global dictionary 'watched' that stores the mapping of monitored paths to sets of subscribed ServerSession objects, directly used by the list_watched handler.watched: Dict[Path, Set[ServerSession]] = {}