Skip to main content
Glama
xinyuzjj

Godot MCP Enhanced

by xinyuzjj

list_projects

Find Godot projects in a directory, with optional recursive search to locate projects in subfolders.

Instructions

List Godot projects in a directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYesDirectory to search for Godot projects
recursiveNoWhether to search recursively (default: false)

Implementation Reference

  • The main handler function handleListProjects that executes the list_projects tool logic. It validates the 'directory' argument, calls findGodotProjects, and returns the results.
    private async handleListProjects(args: any): Promise<ToolResult> {
      args = this.normalizeParameters(args);
    
      if (!args.directory) {
        return this.createErrorResponse('Directory is required');
      }
    
      try {
        const projects = this.findGodotProjects(args.directory, args.recursive || false);
        return this.createSuccessResponse(
          `Found ${projects.length} Godot project(s):`,
          projects
        );
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        return this.createErrorResponse(`Failed to list projects: ${errorMessage}`);
      }
    }
  • The helper function findGodotProjects that recursively/iteratively searches for project.godot files in the given directory and returns project paths and names.
    private findGodotProjects(directory: string, recursive: boolean): Array<{ path: string; name: string }> {
      const projects: Array<{ path: string; name: string }> = [];
    
      try {
        const projectFile = join(directory, 'project.godot');
        if (existsSync(projectFile)) {
          projects.push({
            path: directory,
            name: basename(directory),
          });
        }
    
        if (!recursive) {
          const entries = readdirSync(directory, { withFileTypes: true });
          for (const entry of entries) {
            if (entry.isDirectory()) {
              const subdir = join(directory, entry.name);
              const projectFile = join(subdir, 'project.godot');
              if (existsSync(projectFile)) {
                projects.push({
                  path: subdir,
                  name: entry.name,
                });
              }
            }
          }
        } else {
          const entries = readdirSync(directory, { withFileTypes: true });
          for (const entry of entries) {
            if (entry.isDirectory()) {
              const subdir = join(directory, entry.name);
              if (entry.name.startsWith('.')) {
                continue;
              }
              const projectFile = join(subdir, 'project.godot');
              if (existsSync(projectFile)) {
                projects.push({
                  path: subdir,
                  name: entry.name,
                });
              } else {
                const subProjects = this.findGodotProjects(subdir, true);
                projects.push(...subProjects);
              }
            }
          }
        }
      } catch (error) {
        this.logDebug(`Error searching directory ${directory}: ${error}`);
      }
    
      return projects;
    }
  • The tool registration schema for list_projects, defining its name, description, and input schema with 'directory' (required string) and 'recursive' (optional boolean) parameters.
    {
      name: 'list_projects',
      description: 'List Godot projects in a directory',
      inputSchema: {
        type: 'object',
        properties: {
          directory: {
            type: 'string',
            description: 'Directory to search for Godot projects',
          },
          recursive: {
            type: 'boolean',
            description: 'Whether to search recursively (default: false)',
          },
        },
        required: ['directory'],
      },
    },
  • src/index.ts:799-801 (registration)
    The case statement in the tool dispatch switch that routes 'list_projects' requests to handleListProjects.
    case 'list_projects':
      result = await this.handleListProjects(request.params.arguments);
      break;
Behavior2/5

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

No annotations exist, so the description must carry the burden of behavioral disclosure. It fails to mention that the tool is read-only, what constitutes a valid Godot project, or the format of the list returned.

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, clear sentence with no unnecessary words. It is well-structured and front-loaded with the key action.

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 no output schema and no annotations, the description is incomplete. It does not explain return values, error handling, or what defines a Godot project, leaving significant gaps for an AI agent.

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%, so baseline is 3. The description adds no extra meaning beyond the schema's parameter descriptions; it does not elaborate on directory format or recursive behavior.

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 clearly states the action (list) and resource (Godot projects in a directory). It is specific and distinguishable from sibling tools like 'add_node' or 'create_scene'.

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 instance, it does not explain how 'list_projects' differs from 'get_project_info' or when one might prefer recursive search.

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

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