Skip to main content
Glama

hooks_start_watching

Start file system watching to automatically trigger events based on file changes, enabling context-aware coding assistance.

Instructions

Start file system watching for automatic event triggering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternsNoFile patterns to watch (optional, uses defaults if not provided)

Implementation Reference

  • MCP tool handler for 'hooks_start_watching' that starts file system watching by calling HooksService.startFileWatching with optional patterns.
    tools.set('hooks_start_watching', async (args: any) => {
      await hooksService.startFileWatching(args.patterns);
      return { success: true, message: 'File watching started', patterns: args.patterns };
    });
  • Input schema definition for the hooks_start_watching tool, defining optional patterns array.
    {
      name: 'hooks_start_watching',
      description: 'Start file system watching for automatic event triggering',
      inputSchema: {
        type: 'object',
        properties: {
          patterns: {
            type: 'array',
            items: { type: 'string' },
            description: 'File patterns to watch (optional, uses defaults if not provided)'
          }
        },
        required: []
      }
    },
  • src/index.ts:415-417 (registration)
    Top-level registration of hooks tools (including hooks_start_watching) in the main server by invoking registerHooksTools.
    if (this.config.services.hooks && this.hooksService) {
      const hookTools = registerHooksTools(this.tools, this.hooksService);
      this.toolDefinitions.push(...hookTools);
  • Core implementation of file watching using chokidar, setting up event handlers for file changes invoked by the tool handler.
    async startFileWatching(patterns?: string[]): Promise<void> {
      const watchPatterns = patterns || this.config.fileWatch.patterns;
      
      const watcher = this.watcherFactory.watch(watchPatterns, {
        ignored: this.config.fileWatch.ignored,
        persistent: this.config.fileWatch.persistent,
        ignoreInitial: this.config.fileWatch.ignoreInitial,
        cwd: this.projectRoot
      });
    
      watcher
        .on('add', (path) => this.handleFileSystemEvent('add', path))
        .on('change', (path) => this.handleFileSystemEvent('change', path))
        .on('unlink', (path) => this.handleFileSystemEvent('unlink', path))
        .on('error', (error) => console.error('File watcher error:', error));
    
      this.watchers.set('main', watcher);
      await this.notify('system', 'File watching started');
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action without behavioral details. It doesn't disclose whether this requires specific permissions, how events are triggered, what happens if watching is already active, or any rate limits. For a monitoring tool with zero annotation coverage, this is insufficient.

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 front-loads the core action. Every word contributes to understanding the tool's purpose without any wasted text.

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?

Given no annotations and no output schema, the description is incomplete for a tool that initiates system monitoring. It lacks details on what events are triggered, how to handle them, error conditions, or interaction with other hooks tools, leaving significant gaps for an AI agent.

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

Parameters3/5

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

Schema description coverage is 100%, with the single parameter 'patterns' documented as optional file patterns to watch. The description adds no additional parameter semantics beyond what the schema provides, so baseline 3 is appropriate.

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 verb 'Start' and the resource 'file system watching', specifying it's for 'automatic event triggering'. It distinguishes from sibling 'hooks_stop_watching' by indicating the opposite action, but doesn't differentiate from other hooks tools like 'hooks_trigger' in terms of when to use each.

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?

No explicit guidance on when to use this tool versus alternatives like 'hooks_trigger' or 'hooks_stop_watching'. The description implies it's for initiating monitoring, but lacks context about prerequisites, timing, or comparisons with sibling 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/Ghostseller/CastPlan_mcp'

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