Skip to main content
Glama

configure_file_watcher

Configure file monitoring settings to automatically rebuild code indexes when files change, with options for debounce timing, exclusion patterns, and observer backends.

Instructions

Configure file watcher service settings.

Args:
    enabled: Whether to enable file watcher
    debounce_seconds: Debounce time in seconds before triggering rebuild
    additional_exclude_patterns: Additional directory/file patterns to exclude
    observer_type: Observer backend to use. Options:
        - "auto" (default): kqueue on macOS for reliability, platform default elsewhere
        - "kqueue": Force kqueue observer (macOS/BSD)
        - "fsevents": Force FSEvents observer (macOS only, has known reliability issues)
        - "polling": Cross-platform polling fallback (slower but most compatible)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enabledNo
debounce_secondsNo
additional_exclude_patternsNo
observer_typeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'configure_file_watcher', decorated with @mcp.tool() which registers the tool and handles execution by delegating to SystemManagementService.
    @mcp.tool()
    @handle_mcp_tool_errors(return_type='str')
    def configure_file_watcher(
        ctx: Context,
        enabled: bool = None,
        debounce_seconds: float = None,
        additional_exclude_patterns: list = None,
        observer_type: str = None
    ) -> str:
        """Configure file watcher service settings.
    
        Args:
            enabled: Whether to enable file watcher
            debounce_seconds: Debounce time in seconds before triggering rebuild
            additional_exclude_patterns: Additional directory/file patterns to exclude
            observer_type: Observer backend to use. Options:
                - "auto" (default): kqueue on macOS for reliability, platform default elsewhere
                - "kqueue": Force kqueue observer (macOS/BSD)
                - "fsevents": Force FSEvents observer (macOS only, has known reliability issues)
                - "polling": Cross-platform polling fallback (slower but most compatible)
        """
        return SystemManagementService(ctx).configure_file_watcher(enabled, debounce_seconds, additional_exclude_patterns, observer_type)
  • Core business logic method in SystemManagementService that validates inputs and applies file watcher configuration by updating settings.
    def configure_file_watcher(self, enabled: Optional[bool] = None,
                             debounce_seconds: Optional[float] = None,
                             additional_exclude_patterns: Optional[list] = None,
                             observer_type: Optional[str] = None) -> str:
        """
        Configure file watcher settings with business validation.
    
        Args:
            enabled: Whether to enable file watcher
            debounce_seconds: Debounce time in seconds
            additional_exclude_patterns: Additional patterns to exclude
            observer_type: Observer backend type ("auto", "kqueue", "fsevents", "polling")
    
        Returns:
            Success message with configuration details
    
        Raises:
            ValueError: If configuration is invalid
        """
        # Business validation
        self._validate_configuration_request(enabled, debounce_seconds, additional_exclude_patterns, observer_type)
    
        # Business workflow: Apply configuration
        result = self._apply_file_watcher_configuration(enabled, debounce_seconds, additional_exclude_patterns, observer_type)
    
        return result
  • Private helper method that actually applies the configuration updates to the settings service and generates the response message.
    def _apply_file_watcher_configuration(self, enabled: Optional[bool],
                                        debounce_seconds: Optional[float],
                                        additional_exclude_patterns: Optional[list],
                                        observer_type: Optional[str]) -> str:
        """
        Business logic to apply file watcher configuration.
    
        Args:
            enabled: Enable flag
            debounce_seconds: Debounce time
            additional_exclude_patterns: Exclude patterns
            observer_type: Observer backend type
    
        Returns:
            Success message
    
        Raises:
            ValueError: If configuration cannot be applied
        """
        # Business rule: Settings must be available
        if (not hasattr(self.ctx.request_context.lifespan_context, 'settings') or
            not self.ctx.request_context.lifespan_context.settings):
            raise ValueError("Settings not available - project path not set")
    
        settings = self.ctx.request_context.lifespan_context.settings
    
        # Build updates dictionary
        updates = {}
        if enabled is not None:
            updates["enabled"] = enabled
        if debounce_seconds is not None:
            updates["debounce_seconds"] = debounce_seconds
        if additional_exclude_patterns is not None:
            updates["additional_exclude_patterns"] = additional_exclude_patterns
        if observer_type is not None:
            updates["observer_type"] = observer_type
    
        if not updates:
            return "No configuration changes specified"
    
        # Apply configuration
        settings.update_file_watcher_config(updates)
    
        # Business logic: Generate informative result message
        changes_summary = []
        if 'enabled' in updates:
            changes_summary.append(f"enabled={updates['enabled']}")
        if 'debounce_seconds' in updates:
            changes_summary.append(f"debounce={updates['debounce_seconds']}s")
        if 'additional_exclude_patterns' in updates:
            pattern_count = len(updates['additional_exclude_patterns'])
            changes_summary.append(f"exclude_patterns={pattern_count}")
        if 'observer_type' in updates:
            changes_summary.append(f"observer_type={updates['observer_type']}")
    
        changes_str = ", ".join(changes_summary)
    
        return (f"File watcher configuration updated: {changes_str}. "
                f"Restart may be required for changes to take effect.")
Behavior3/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. It describes what gets configured (file watcher settings) and provides important context about observer backend options and their tradeoffs, but doesn't mention permission requirements, side effects, or what the configuration change affects.

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

Conciseness4/5

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

The description is well-structured with a clear purpose statement followed by detailed parameter explanations. The bullet-point format for observer_type options is particularly effective. While comprehensive, it remains focused without unnecessary elaboration.

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

Completeness4/5

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

Given the 4 parameters with 0% schema coverage and the presence of an output schema, the description does an excellent job explaining parameter semantics. It provides complete information about observer_type options with platform-specific guidance. The main gap is lack of behavioral context about the tool's effects and usage scenarios.

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

Parameters5/5

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

The description adds substantial value beyond the input schema, which has 0% description coverage. It explains what each parameter controls, provides the 'auto' default for observer_type, documents all observer backend options with platform-specific details and reliability notes, and clarifies that additional_exclude_patterns are directory/file patterns.

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 tool's purpose as 'Configure file watcher service settings' which is a specific verb+resource combination. However, it doesn't explicitly distinguish this from sibling tools like 'get_file_watcher_status' or 'clear_settings' that might relate to the same service.

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. There's no mention of prerequisites, when this configuration should be applied, or how it relates to sibling tools like 'get_file_watcher_status' or 'set_project_path'.

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/johnhuang316/code-index-mcp'

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