Skip to main content
Glama

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
NameRequiredDescriptionDefault

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))]
  • 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]] = {}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hesreallyhim/mcp-observer-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server