get_project_root
Locate the project root directory and count indexed GDScript files to analyze code structure in Godot game engine projects.
Instructions
Get the current project root directory and count of indexed GDScript files.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_gdscript/tools.py:425-451 (handler)The main handler function that executes the get_project_root tool logic. It returns the current project root directory path and the count of indexed GDScript files if a project root has been set, otherwise returns a message indicating no project root is set.def _get_project_root(self) -> CallToolResult: """Get the current project root. Returns: CallToolResult with project root info """ try: if not self.project_root: return CallToolResult( content=[TextContent(type="text", text="No project root set")], isError=False, ) result = { "project_root": str(self.project_root), "gdscript_files_count": len(self._gdscript_files), } 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 getting project root: {str(e)}")], isError=True, )
- src/mcp_gdscript/tools.py:116-124 (schema)Defines the schema for the 'get_project_root' tool, specifying its name, description, and empty input schema (no parameters required). This is part of the tools list returned by get_tools().Tool( name="get_project_root", description="Get the current project root directory and count of indexed GDScript files.", inputSchema={ "type": "object", "properties": {}, "required": [], }, ),
- src/mcp_gdscript/tools.py:168-169 (registration)Registers the tool handler in the central dispatch method handle_tool_call by routing calls to 'get_project_root' to the _get_project_root implementation.elif tool_name == "get_project_root": return self._get_project_root()