Skip to main content
Glama

subscribe

Monitor file or directory changes to receive real-time notifications for automatic updates in AI assistant workflows.

Instructions

Subscribe to changes on a file or directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Executes the subscribe tool: resolves path, adds current session to watched paths subscribers, notifies if new path, returns confirmation.
    if name == "subscribe":
        assert path_str is not None, "path_str should not be None for subscribe tool"
        p = Path(path_str).expanduser().resolve()
        is_new_path = p not in watched
        watched.setdefault(p, set()).add(session)
    
        # Send notification if this is a new path being watched
        if is_new_path:
            asyncio.create_task(send_resources_list_changed_notification())
    
        return [TextContent(type="text", text=f"Subscribed to {p}")]
  • Defines the input schema for the 'subscribe' tool, requiring a 'path' string parameter.
    Tool(
        name="subscribe",
        description="Subscribe to changes on a file or directory",
        inputSchema={
            "type": "object",
            "properties": {"path": {"type": "string"}},
            "required": ["path"],
        },
    ),
  • Registers the 'subscribe' tool (among others) by returning it in the list_tools() handler.
    @server.list_tools()
    async def list_tools() -> list[Tool]:
        return [
            Tool(
                name="subscribe",
                description="Subscribe to changes on a file or directory",
                inputSchema={
                    "type": "object",
                    "properties": {"path": {"type": "string"}},
                    "required": ["path"],
                },
            ),
            Tool(
                name="unsubscribe",
                description="Unsubscribe from changes on a file or directory",
                inputSchema={
                    "type": "object",
                    "properties": {"path": {"type": "string"}},
                    "required": ["path"],
                },
            ),
            Tool(
                name="list_watched",
                description="List all currently monitored paths and their subscriber counts",
                inputSchema={
                    "type": "object",
                    "properties": {},
                    "additionalProperties": False,
                },
            ),
            Tool(
                name="subscribe_default",
                description="Subscribe to the default watched.txt file for development",
                inputSchema={
                    "type": "object",
                    "properties": {},
                    "additionalProperties": False,
                },
            ),
        ]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Subscribe to changes' implies a monitoring/notification function, it doesn't describe what kind of changes trigger notifications, how notifications are delivered, whether this requires specific permissions, rate limits, or what happens when multiple subscriptions exist. This leaves significant behavioral gaps for a tool that likely establishes ongoing monitoring.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a tool with one parameter and gets straight to the point with zero wasted verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a subscription tool with no annotations, no output schema, and minimal parameter documentation, the description is inadequate. It doesn't explain what 'subscribing' entails operationally, what format notifications take, how to manage subscriptions, or what the tool returns. Given the complexity of establishing monitoring and the complete lack of structured documentation, this description leaves too many questions unanswered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for the single 'path' parameter, the description provides no additional semantic information about what the path represents, its format, or constraints. The description mentions 'file or directory' which gives some context for the path parameter, but this is minimal compensation for the complete lack of schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Subscribe to changes') and target resource ('on a file or directory'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from its sibling 'subscribe_default', which appears to be a related subscription tool, so it doesn't fully differentiate from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'subscribe_default' or 'list_watched'. It doesn't mention prerequisites, exclusions, or contextual factors that would help an agent choose between subscription-related tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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