Skip to main content
Glama

get_project_info

Retrieve metadata about a Godot project directory to understand its structure, configuration, and properties for development workflows.

Instructions

Retrieve metadata about a Godot project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the Godot project directory

Implementation Reference

  • The main handler function for the 'get_project_info' tool. Validates input, checks project validity, retrieves Godot version, scans project structure, extracts project name from project.godot, and returns JSON with project metadata.
    private async handleGetProjectInfo(args: any) {
      // Normalize parameters to camelCase
      args = this.normalizeParameters(args);
      
      if (!args.projectPath) {
        return this.createErrorResponse(
          'Project path is required',
          ['Provide a valid path to a Godot project directory']
        );
      }
    
      if (!this.validatePath(args.projectPath)) {
        return this.createErrorResponse(
          'Invalid project path',
          ['Provide a valid path without ".." or other potentially unsafe characters']
        );
      }
    
      try {
        // Ensure godotPath is set
        if (!this.godotPath) {
          await this.detectGodotPath();
          if (!this.godotPath) {
            return this.createErrorResponse(
              'Could not find a valid Godot executable path',
              [
                'Ensure Godot is installed correctly',
                'Set GODOT_PATH environment variable to specify the correct path',
              ]
            );
          }
        }
    
        // Check if the project directory exists and contains a project.godot file
        const projectFile = join(args.projectPath, 'project.godot');
        if (!existsSync(projectFile)) {
          return this.createErrorResponse(
            `Not a valid Godot project: ${args.projectPath}`,
            [
              'Ensure the path points to a directory containing a project.godot file',
              'Use list_projects to find valid Godot projects',
            ]
          );
        }
    
        this.logDebug(`Getting project info for: ${args.projectPath}`);
    
        // Get Godot version
        const execOptions = { timeout: 10000 }; // 10 second timeout
        const { stdout } = await execAsync(`"${this.godotPath}" --version`, execOptions);
    
        // Get project structure using the recursive method
        const projectStructure = await this.getProjectStructureAsync(args.projectPath);
    
        // Extract project name from project.godot file
        let projectName = basename(args.projectPath);
        try {
          const fs = require('fs');
          const projectFileContent = fs.readFileSync(projectFile, 'utf8');
          const configNameMatch = projectFileContent.match(/config\/name="([^"]+)"/);
          if (configNameMatch && configNameMatch[1]) {
            projectName = configNameMatch[1];
            this.logDebug(`Found project name in config: ${projectName}`);
          }
        } catch (error) {
          this.logDebug(`Error reading project file: ${error}`);
          // Continue with default project name if extraction fails
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  name: projectName,
                  path: args.projectPath,
                  godotVersion: stdout.trim(),
                  structure: projectStructure,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error: any) {
        return this.createErrorResponse(
          `Failed to get project info: ${error?.message || 'Unknown error'}`,
          [
            'Ensure Godot is installed correctly',
            'Check if the GODOT_PATH environment variable is set correctly',
            'Verify the project path is accessible',
          ]
        );
      }
    }
  • The input schema and description for the 'get_project_info' tool, defining the required projectPath parameter.
      name: 'get_project_info',
      description: 'Retrieve metadata about a Godot project',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description: 'Path to the Godot project directory',
          },
        },
        required: ['projectPath'],
      },
    },
  • src/index.ts:946-947 (registration)
    The switch case that routes calls to the 'get_project_info' tool to its handler method.
    case 'get_project_info':
      return await this.handleGetProjectInfo(request.params.arguments);
  • Helper function that recursively scans the project directory to count scenes (.tscn), scripts (.gd, .gdscript, .cs), assets (images, audio), and other files for the project structure summary.
    private getProjectStructureAsync(projectPath: string): Promise<any> {
      return new Promise((resolve) => {
        try {
          const structure = {
            scenes: 0,
            scripts: 0,
            assets: 0,
            other: 0,
          };
    
          const scanDirectory = (currentPath: string) => {
            const entries = readdirSync(currentPath, { withFileTypes: true });
            
            for (const entry of entries) {
              const entryPath = join(currentPath, entry.name);
              
              // Skip hidden files and directories
              if (entry.name.startsWith('.')) {
                continue;
              }
              
              if (entry.isDirectory()) {
                // Recursively scan subdirectories
                scanDirectory(entryPath);
              } else if (entry.isFile()) {
                // Count file by extension
                const ext = entry.name.split('.').pop()?.toLowerCase();
                
                if (ext === 'tscn') {
                  structure.scenes++;
                } else if (ext === 'gd' || ext === 'gdscript' || ext === 'cs') {
                  structure.scripts++;
                } else if (['png', 'jpg', 'jpeg', 'webp', 'svg', 'ttf', 'wav', 'mp3', 'ogg'].includes(ext || '')) {
                  structure.assets++;
                } else {
                  structure.other++;
                }
              }
            }
          };
          
          // Start scanning from the project root
          scanDirectory(projectPath);
          resolve(structure);
        } catch (error) {
          this.logDebug(`Error getting project structure asynchronously: ${error}`);
          resolve({ 
            error: 'Failed to get project structure',
            scenes: 0,
            scripts: 0,
            assets: 0,
            other: 0
          });
        }
      });
    }
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 only states the basic action without behavioral details. It doesn't disclose if this is a read-only operation, what metadata is included, error conditions, or performance characteristics, which are critical for a tool with unknown behavior.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what metadata is returned, potential errors, or how it interacts with sibling tools, leaving significant gaps for a tool that retrieves project information.

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 schema description coverage is 100%, so the input schema already documents the 'projectPath' parameter fully. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints, meeting 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 action ('Retrieve metadata') and target resource ('about a Godot project'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_projects' or 'get_godot_version', which prevents a perfect score.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't clarify if this is for a specific project path versus listing all projects (as 'list_projects' might do), leaving the agent to infer usage from context alone.

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/Coding-Solo/godot-mcp'

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