Skip to main content
Glama
wrale

mcp-server-tree-sitter

by wrale

diagnose_config

Identify and resolve issues in YAML configuration files by providing detailed diagnostic information. Helps ensure correct loading and processing of configurations for improved code analysis.

Instructions

Diagnose issues with YAML configuration loading.

    Args:
        config_path: Path to YAML config file

    Returns:
        Diagnostic information
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
config_pathYes

Implementation Reference

  • MCP tool handler for 'diagnose_config', decorated with @mcp_server.tool() for registration. This is the entry point executed by the MCP server, which delegates the core logic to diagnose_yaml_config in debug.py.
    def diagnose_config(config_path: str) -> Dict[str, Any]:
        """Diagnose issues with YAML configuration loading.
    
        Args:
            config_path: Path to YAML config file
    
        Returns:
            Diagnostic information
        """
        from ..tools.debug import diagnose_yaml_config
    
        return diagnose_yaml_config(config_path)
  • Core helper function implementing the diagnosis logic: checks file existence, readability, YAML parsing, config creation and update, returning detailed diagnostic results.
    def diagnose_yaml_config(config_path: str) -> Dict[str, Any]:
        """Diagnose issues with YAML configuration loading.
    
        Args:
            config_path: Path to YAML config file
    
        Returns:
            Dictionary with diagnostic information
        """
        result = {
            "file_path": config_path,
            "exists": False,
            "readable": False,
            "yaml_valid": False,
            "parsed_data": None,
            "config_before": None,
            "config_after": None,
            "error": None,
        }
    
        # Check if file exists
        path_obj = Path(config_path)
        result["exists"] = path_obj.exists()
    
        if not result["exists"]:
            result["error"] = f"File does not exist: {config_path}"
            return result
    
        # Check if file is readable
        try:
            with open(path_obj, "r") as f:
                content = f.read()
                result["readable"] = True
                result["file_content"] = content
        except Exception as e:
            result["error"] = f"Error reading file: {str(e)}"
            return result
    
        # Try to parse YAML
        try:
            config_data = yaml.safe_load(content)
            result["yaml_valid"] = True
            result["parsed_data"] = config_data
        except Exception as e:
            result["error"] = f"Error parsing YAML: {str(e)}"
            return result
    
        # Check if parsed data is None or empty
        if config_data is None:
            result["error"] = "YAML parser returned None (file empty or contains only comments)"
            return result
    
        if not isinstance(config_data, dict):
            result["error"] = f"YAML parser returned non-dict: {type(config_data)}"
            return result
    
        # Try creating a new config
        try:
            # Get current config
            current_config = global_context.get_config()
            result["config_before"] = {
                "cache.max_size_mb": current_config.cache.max_size_mb,
                "security.max_file_size_mb": current_config.security.max_file_size_mb,
                "language.default_max_depth": current_config.language.default_max_depth,
            }
    
            # Create new config from parsed data
            new_config = ServerConfig(**config_data)
    
            # Before update
            result["new_config"] = {
                "cache.max_size_mb": new_config.cache.max_size_mb,
                "security.max_file_size_mb": new_config.security.max_file_size_mb,
                "language.default_max_depth": new_config.language.default_max_depth,
            }
    
            # Update config
            update_config_from_new(current_config, new_config)
    
            # After update
            result["config_after"] = {
                "cache.max_size_mb": current_config.cache.max_size_mb,
                "security.max_file_size_mb": current_config.security.max_file_size_mb,
                "language.default_max_depth": current_config.language.default_max_depth,
            }
    
        except Exception as e:
            result["error"] = f"Error updating config: {str(e)}"
            return result
    
        return result
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool returns 'Diagnostic information,' but doesn't specify what that entails (e.g., error messages, suggestions, logs) or any behavioral traits like side effects, performance considerations, or error handling. This leaves significant gaps for a diagnostic tool.

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 concise and front-loaded with the main purpose in the first sentence. The Args and Returns sections are structured but could be integrated more smoothly. There's no wasted text, though it could benefit from slightly more elaboration to improve completeness.

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 the tool's complexity (diagnostic operation), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't explain what 'Diagnostic information' includes, potential error cases, or usage context, making it inadequate for an AI agent to fully understand the tool's behavior and outputs.

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?

The description adds minimal semantics beyond the input schema. It defines 'config_path' as 'Path to YAML config file,' which clarifies the parameter's purpose, but with 0% schema description coverage and only one parameter, this is a baseline improvement. However, it doesn't provide details like expected file formats, path resolution, or validation rules.

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: 'Diagnose issues with YAML configuration loading.' This specifies the verb ('diagnose') and resource ('YAML configuration loading'), making it understandable. However, it doesn't distinguish this tool from potential sibling tools that might also handle configuration issues, though none of the listed siblings appear to directly overlap.

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. It doesn't mention prerequisites, exclusions, or related tools. For example, it doesn't specify if this is for syntax errors, semantic issues, or other problems, nor does it reference sibling tools like 'configure' or 'analyze_project' that might be relevant.

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

Related 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/wrale/mcp-server-tree-sitter'

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