Skip to main content
Glama
xinyuzjj

Godot MCP Enhanced

by xinyuzjj

update_project_uids

Update UID references in Godot projects by resaving resources. Resolves broken references after moving or renaming files (Godot 4.4+).

Instructions

Update UID references in a Godot project by resaving resources (for Godot 4.4+)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the Godot project directory

Implementation Reference

  • Handler function that executes the 'update_project_uids' tool logic. Validates projectPath, then delegates to executeOperation which runs a Godot script with the operation name.
    private async handleUpdateProjectUids(args: any): Promise<ToolResult> {
      args = this.normalizeParameters(args);
    
      if (!args.projectPath) {
        return this.createErrorResponse('Project path is required');
      }
    
      try {
        const { stdout, stderr } = await this.executeOperation(
          'update_project_uids',
          {},
          args.projectPath
        );
    
        if (stderr && stderr.includes('ERROR')) {
          return this.createErrorResponse(`Failed to update UIDs: ${stderr}`);
        }
    
        return this.createSuccessResponse(`Project UIDs updated successfully`, stdout);
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        return this.createErrorResponse(`Failed to update UIDs: ${errorMessage}`);
      }
    }
  • Tool registration with input schema definition for 'update_project_uids'. Defines the name, description, and inputSchema requiring 'projectPath' (string).
    {
      name: 'update_project_uids',
      description: 'Update UID references in a Godot project by resaving resources (for Godot 4.4+)',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description: 'Path to the Godot project directory',
          },
        },
        required: ['projectPath'],
      },
    },
  • src/index.ts:826-828 (registration)
    Switch-case dispatch that routes the 'update_project_uids' tool call to the handler handleUpdateProjectUids.
    case 'update_project_uids':
      result = await this.handleUpdateProjectUids(request.params.arguments);
      break;
  • executeOperation helper method that runs the actual Godot script. It takes an operation name and parameters, builds a Godot command line with --headless --path --script, and executes it.
    private async executeOperation(
      operation: string,
      params: OperationParams,
      projectPath: string
    ): Promise<{ stdout: string; stderr: string }> {
      this.logDebug(`Executing operation: ${operation} in project: ${projectPath}`);
      this.logDebug(`Original operation params: ${JSON.stringify(params)}`);
    
      const snakeCaseParams = this.convertCamelToSnakeCase(params);
      this.logDebug(`Converted snake_case params: ${JSON.stringify(snakeCaseParams)}`);
    
      if (!this.godotPath) {
        await this.detectGodotPath();
        if (!this.godotPath) {
          throw new Error('Could not find a valid Godot executable path');
        }
      }
    
      try {
        const paramsJson = JSON.stringify(snakeCaseParams);
    
        const args = [
          '--headless',
          '--path',
          projectPath,
          '--script',
          this.operationsScriptPath,
          operation,
          paramsJson,
        ];
    
        if (GODOT_DEBUG_MODE) {
          args.push('--debug-godot');
        }
    
        this.logDebug(`Executing: ${this.godotPath} ${args.join(' ')}`);
    
        const { stdout, stderr } = await execFileAsync(this.godotPath!, args);
    
        return { stdout: stdout ?? '', stderr: stderr ?? '' };
      } catch (error: unknown) {
        if (error instanceof Error && 'stdout' in error && 'stderr' in error) {
          const execError = error as Error & { stdout: string; stderr: string };
          return {
            stdout: execError.stdout ?? '',
            stderr: execError.stderr ?? '',
          };
        }
    
        throw error;

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations provided, the description carries full responsibility for behavioral disclosure. It mentions resaving resources, implying file modifications, but does not disclose potential side effects, reversibility, permissions needed, or whether it may alter many files. The version requirement is useful but insufficient 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, compact sentence that front-loads the primary action and resource. It avoids extraneous detail and is appropriately sized for a simple tool.

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?

For a tool with one parameter, no output schema, and no annotations, the description is minimally adequate. It explains what it does and the version constraint, but omits guidance on when to use it and potential side effects. Given the simplicity, it is not severely incomplete but lacks context an agent might need to decide 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?

The single parameter has 100% schema coverage with a clear description ('Path to the Godot project directory'). The tool description adds no additional meaning beyond the schema, so it meets the baseline for a fully documented parameter but does not enhance understanding further.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Update'), a resource ('UID references in a Godot project'), and a method ('by resaving resources'). It clearly identifies the tool's function and includes a version constraint (Godot 4.4+), distinguishing it from sibling tools like get_uid that retrieve UIDs.

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 explicit guidance on when to use this tool versus alternatives. It only mentions a version requirement, but does not explain scenarios (e.g., after moving or renaming files) or when to prefer other project tools. The intended use is implied but not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.