Skip to main content
Glama
wrale

mcp-server-tree-sitter

by wrale

register_project_tool

Register a project directory for code exploration by specifying the path, name, and description. Enables context-aware code analysis using tree-sitter for intelligent codebase access.

Instructions

Register a project directory for code exploration.

    Args:
        path: Path to the project directory
        name: Optional name for the project (defaults to directory name)
        description: Optional description of the project

    Returns:
        Project information
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNo
nameNo
pathYes

Implementation Reference

  • The core handler function for the MCP tool 'register_project_tool'. It registers a new project using the project_registry, scans the project files to detect languages, handles errors with ProjectError, and returns the project information as a dictionary.
    @mcp_server.tool()
    def register_project_tool(
        path: str, name: Optional[str] = None, description: Optional[str] = None
    ) -> Dict[str, Any]:
        """Register a project directory for code exploration.
    
        Args:
            path: Path to the project directory
            name: Optional name for the project (defaults to directory name)
            description: Optional description of the project
    
        Returns:
            Project information
        """
        try:
            # Register project
            project = project_registry.register_project(name or path, path, description)
    
            # Scan for languages
            project.scan_files(language_registry)
    
            return project.to_dict()
        except Exception as e:
            raise ProjectError(f"Failed to register project: {e}") from e
  • The registration point where register_tools is called on the MCP server instance, which in turn defines and registers the 'register_project_tool' handler along with all other tools.
    register_capabilities(mcp)
    register_tools(mcp, container)
  • Helper API function 'register_project' that performs similar project registration logic, used in tests via alias 'api_register_project'.
    def register_project(path: str, name: Optional[str] = None, description: Optional[str] = None) -> Dict[str, Any]:
        """Register a project."""
        project_registry = get_project_registry()
        language_registry = get_language_registry()
    
        try:
            # Register project
            project = project_registry.register_project(name or path, path, description)
    
            # Scan for languages
            project.scan_files(language_registry)
    
            project_dict = project.to_dict()
            # Add type annotations
            result: Dict[str, Any] = {
                "name": project_dict["name"],
                "root_path": project_dict["root_path"],
                "description": project_dict["description"],
                "languages": project_dict["languages"],
                "last_scan_time": project_dict["last_scan_time"],
            }
            return result
        except Exception as e:
            raise ProjectError(f"Failed to register project: {e}") from e
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 offers minimal behavioral insight. It mentions registration for 'code exploration' but doesn't disclose what registration entails (e.g., indexing, caching, permissions needed), potential side effects, or error conditions. This leaves significant gaps for a mutation 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 appropriately sized and front-loaded with the core purpose in the first sentence. The Args/Returns structure is clear but includes some redundancy (e.g., repeating 'Optional' for parameters already marked nullable in schema). Overall efficient with minimal waste.

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, no output schema, and a mutation tool with 3 parameters, the description is incomplete. It lacks details on what 'Project information' returns, error handling, or behavioral traits like idempotency. For a registration tool, this leaves critical gaps for an agent to use it correctly.

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 0%, so the description must compensate. It lists all three parameters with brief explanations, adding meaning beyond the bare schema (e.g., 'path' is to the directory, 'name' defaults to directory name). However, it doesn't detail constraints like path format or description length, leaving some ambiguity.

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 ('Register') and resource ('a project directory for code exploration'), providing a specific purpose. However, it doesn't explicitly differentiate from sibling tools like 'list_projects_tool' or 'remove_project_tool', which would require mentioning it's for initial registration rather than listing or deletion.

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 (e.g., whether the directory must exist), or contrast with siblings like 'list_projects_tool' for viewing registered projects or 'remove_project_tool' for unregistering.

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