Skip to main content
Glama
minami110

GDScript Code Analyzer

by minami110

set_project_root

Set the project root directory to enable project-wide GDScript analysis, indexing all .gd files for efficient code navigation and understanding in Godot projects.

Instructions

Set the project root directory to enable project-wide analysis. This will index all .gd files in the project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_rootYesPath to the project root directory

Implementation Reference

  • Core handler function implementing the 'set_project_root' tool logic: validates path, sets project root, indexes .gd files, returns JSON result.
    def _set_project_root(self, project_root: str) -> CallToolResult:
        """Set the project root directory.
    
        Args:
            project_root: Path to the project root
    
        Returns:
            CallToolResult with status
        """
        try:
            root_path = Path(project_root).resolve()
            if not root_path.exists():
                return CallToolResult(
                    content=[TextContent(type="text", text=f"Project root does not exist: {project_root}")],
                    isError=True,
                )
    
            if not root_path.is_dir():
                return CallToolResult(
                    content=[TextContent(type="text", text=f"Project root is not a directory: {project_root}")],
                    isError=True,
                )
    
            self.project_root = root_path
            self._load_gdscript_files()
    
            result = {
                "project_root": str(self.project_root),
                "gdscript_files_count": len(self._gdscript_files),
                "status": "success",
            }
    
            return CallToolResult(
                content=[TextContent(type="text", text=json.dumps(result, indent=2))],
                isError=False,
            )
        except Exception as e:
            return CallToolResult(
                content=[TextContent(type="text", text=f"Error setting project root: {str(e)}")],
                isError=True,
            )
  • Input schema definition for the 'set_project_root' tool, specifying the required 'project_root' string parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "project_root": {
                "type": "string",
                "description": "Path to the project root directory",
            }
        },
        "required": ["project_root"],
    },
  • Registration of the 'set_project_root' tool in the get_tools() method's return list, including name, description, and schema.
    Tool(
        name="set_project_root",
        description="Set the project root directory to enable project-wide analysis. This will index all .gd files in the project.",
        inputSchema={
            "type": "object",
            "properties": {
                "project_root": {
                    "type": "string",
                    "description": "Path to the project root directory",
                }
            },
            "required": ["project_root"],
        },
    ),
  • Dispatch/registration in handle_tool_call method that routes 'set_project_root' calls to the _set_project_root handler.
    elif tool_name == "set_project_root":
        return self._set_project_root(tool_input["project_root"])
  • Helper utility called by the handler to index all GDScript (.gd) files recursively from the project root.
    def _load_gdscript_files(self) -> None:
        """Load all .gd files from the project root."""
        if not self.project_root:
            self._gdscript_files = []
            return
    
        self._gdscript_files = []
        for file_path in self.project_root.rglob("*.gd"):
            self._gdscript_files.append(file_path)
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. It mentions indexing .gd files, which adds behavioral context beyond the basic 'set' action. However, it lacks details on permissions needed, whether the operation is reversible, potential performance impact of indexing, or error handling (e.g., invalid paths).

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 two concise sentences that are front-loaded with the core purpose and outcome. Every word contributes meaning without redundancy, making it efficient and well-structured.

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

Completeness3/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 provides basic purpose and behavioral hint (indexing). However, for a tool that likely mutates state and enables other operations, it should cover more (e.g., effects on sibling tools, error cases). It's minimally adequate but has clear gaps in context.

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 parameter 'project_root' well-documented in the schema. The description doesn't add any parameter-specific details beyond what the schema provides (e.g., format examples or constraints), so it meets the baseline for high schema coverage.

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 with a specific verb ('Set') and resource ('project root directory'), and explains the outcome ('enable project-wide analysis', 'index all .gd files'). It distinguishes from the sibling 'get_project_root' by being the setter counterpart, though it doesn't explicitly name that sibling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('to enable project-wide analysis'), suggesting this is a prerequisite for other analysis tools. However, it doesn't explicitly state when to use this vs. alternatives (e.g., not needed for single-file analysis) or name specific sibling tools for comparison.

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/minami110/mcp-gdscript'

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