Skip to main content
Glama

hooks_start_watching

Initiate file system monitoring to automatically trigger events based on specified file patterns, enhancing context-aware project automation in CastPlan MCP.

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 implementation for 'hooks_start_watching'. 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 }; });
  • Tool schema definition including name, description, and input schema for 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: [] } },
  • Core helper method implementing file watching using chokidar. Sets up watchers for file events (add, change, unlink), configures options, and handles events by processing HookEvents.
    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'); }
  • src/index.ts:415-417 (registration)
    Top-level registration of all hooks tools (including 'hooks_start_watching') in the main MCP server by invoking registerHooksTools and adding to toolDefinitions.
    if (this.config.services.hooks && this.hooksService) { const hookTools = registerHooksTools(this.tools, this.hooksService); this.toolDefinitions.push(...hookTools);

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