Skip to main content
Glama

get_uid

Retrieve the unique identifier (UID) for files in Godot 4.4+ projects to enable precise asset referencing and management.

Instructions

Get the UID for a specific file in a Godot project (for Godot 4.4+)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the Godot project directory
filePathYesPath to the file (relative to project) for which to get the UID

Implementation Reference

  • The handler function that implements the get_uid tool logic. Validates inputs, checks Godot 4.4+ compatibility, executes the Godot operations script with 'get_uid' command.
    private async handleGetUid(args: any) {
      // Normalize parameters to camelCase
      args = this.normalizeParameters(args);
      
      if (!args.projectPath || !args.filePath) {
        return this.createErrorResponse(
          'Missing required parameters',
          ['Provide projectPath and filePath']
        );
      }
    
      if (!this.validatePath(args.projectPath) || !this.validatePath(args.filePath)) {
        return this.createErrorResponse(
          'Invalid path',
          ['Provide valid paths 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',
            ]
          );
        }
    
        // Check if the file exists
        const filePath = join(args.projectPath, args.filePath);
        if (!existsSync(filePath)) {
          return this.createErrorResponse(
            `File does not exist: ${args.filePath}`,
            ['Ensure the file path is correct']
          );
        }
    
        // Get Godot version to check if UIDs are supported
        const { stdout: versionOutput } = await execAsync(`"${this.godotPath}" --version`);
        const version = versionOutput.trim();
    
        if (!this.isGodot44OrLater(version)) {
          return this.createErrorResponse(
            `UIDs are only supported in Godot 4.4 or later. Current version: ${version}`,
            [
              'Upgrade to Godot 4.4 or later to use UIDs',
              'Use resource paths instead of UIDs for this version of Godot',
            ]
          );
        }
    
        // Prepare parameters for the operation (already in camelCase)
        const params = {
          filePath: args.filePath,
        };
    
        // Execute the operation
        const { stdout, stderr } = await this.executeOperation('get_uid', params, args.projectPath);
    
        if (stderr && stderr.includes('Failed to')) {
          return this.createErrorResponse(
            `Failed to get UID: ${stderr}`,
            [
              'Check if the file is a valid Godot resource',
              'Ensure the file path is correct',
            ]
          );
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `UID for ${args.filePath}: ${stdout.trim()}`,
            },
          ],
        };
      } catch (error: any) {
        return this.createErrorResponse(
          `Failed to get UID: ${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 definition for the get_uid tool, specifying required projectPath and filePath parameters.
      name: 'get_uid',
      description: 'Get the UID for a specific file in a Godot project (for Godot 4.4+)',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description: 'Path to the Godot project directory',
          },
          filePath: {
            type: 'string',
            description: 'Path to the file (relative to project) for which to get the UID',
          },
        },
        required: ['projectPath', 'filePath'],
      },
    },
  • src/index.ts:958-959 (registration)
    Registration of the get_uid tool handler in the CallToolRequestSchema switch statement, dispatching to handleGetUid.
    case 'get_uid':
      return await this.handleGetUid(request.params.arguments);
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 states the tool retrieves a UID but does not disclose behavioral traits such as whether it's a read-only operation, error handling for invalid paths, performance implications, or output format. This is a significant gap for a tool with no annotation coverage.

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 any unnecessary words. It is front-loaded and appropriately sized for the tool's complexity, with zero 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 the complexity (a tool with two parameters and no output schema) and lack of annotations, the description is incomplete. It does not explain what a UID is, how it's used, or what the return value looks like, leaving gaps for an AI agent to understand the tool's full context and usage.

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 input schema has 100% description coverage, with clear descriptions for both parameters ('projectPath' and 'filePath'). The description adds no additional meaning beyond the schema, such as examples or constraints, but the schema adequately documents the parameters, meeting the baseline for high 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: 'Get the UID for a specific file in a Godot project (for Godot 4.4+)'. It specifies the verb ('Get'), resource ('UID'), and context ('Godot project'), but does not explicitly differentiate it from sibling tools like 'get_project_info' or 'update_project_uids', which might also involve UIDs or project data.

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 does not mention any prerequisites, such as needing an existing project or file, or when to choose this over other tools like 'get_project_info' for broader project data. Usage is implied but not explicitly stated.

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