Skip to main content
Glama

list_projects

Find and display Godot projects within a specified directory to help users locate and manage their game development files.

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

  • Handler function for the 'list_projects' tool. Validates input directory, calls findGodotProjects helper, and returns JSON list of projects.
    private async handleListProjects(args: any) {
      // Normalize parameters to camelCase
      args = this.normalizeParameters(args);
      
      if (!args.directory) {
        return this.createErrorResponse(
          'Directory is required',
          ['Provide a valid directory path to search for Godot projects']
        );
      }
    
      if (!this.validatePath(args.directory)) {
        return this.createErrorResponse(
          'Invalid directory path',
          ['Provide a valid path without ".." or other potentially unsafe characters']
        );
      }
    
      try {
        this.logDebug(`Listing Godot projects in directory: ${args.directory}`);
        if (!existsSync(args.directory)) {
          return this.createErrorResponse(
            `Directory does not exist: ${args.directory}`,
            ['Provide a valid directory path that exists on the system']
          );
        }
    
        const recursive = args.recursive === true;
        const projects = this.findGodotProjects(args.directory, recursive);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(projects, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return this.createErrorResponse(
          `Failed to list projects: ${error?.message || 'Unknown error'}`,
          [
            'Ensure the directory exists and is accessible',
            'Check if you have permission to read the directory',
          ]
        );
      }
    }
  • Input schema and registration for the 'list_projects' tool in the ListTools response.
    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'],
    },
  • Core helper function that implements the logic to find Godot projects by searching for 'project.godot' files in directories, supporting recursive search.
    private findGodotProjects(directory: string, recursive: boolean): Array<{ path: string; name: string }> {
      const projects: Array<{ path: string; name: string }> = [];
    
      try {
        // Check if the directory itself is a Godot project
        const projectFile = join(directory, 'project.godot');
        if (existsSync(projectFile)) {
          projects.push({
            path: directory,
            name: basename(directory),
          });
        }
    
        // If not recursive, only check immediate subdirectories
        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 {
          // Recursive search
          const entries = readdirSync(directory, { withFileTypes: true });
          for (const entry of entries) {
            if (entry.isDirectory()) {
              const subdir = join(directory, entry.name);
              // Skip hidden directories
              if (entry.name.startsWith('.')) {
                continue;
              }
              // Check if this directory is a Godot project
              const projectFile = join(subdir, 'project.godot');
              if (existsSync(projectFile)) {
                projects.push({
                  path: subdir,
                  name: entry.name,
                });
              } else {
                // Recursively search this directory
                const subProjects = this.findGodotProjects(subdir, true);
                projects.push(...subProjects);
              }
            }
          }
        }
      } catch (error) {
        this.logDebug(`Error searching directory ${directory}: ${error}`);
      }
    
      return projects;
    }
  • src/index.ts:944-945 (registration)
    Dispatch/registration in the CallToolRequestSchema switch statement that routes calls to the list_projects handler.
    case 'list_projects':
      return await this.handleListProjects(request.params.arguments);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('List') but doesn't describe traits like whether this is a read-only operation, what the output format looks like (e.g., list of project names or paths), error handling, or performance considerations (e.g., speed for large directories). This leaves significant gaps for a tool with two parameters.

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 wasted words. It's front-loaded and appropriately sized for a simple listing tool, earning full marks for conciseness.

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 'Godot projects' means (e.g., files with .godot extension), the return format, or error cases. For a tool with parameters and no structured output info, more context is needed to guide the agent effectively.

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 both parameters ('directory' and 'recursive') clearly. The description adds no additional meaning beyond implying a search operation, which is already covered by the schema. This meets 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 verb ('List') and resource ('Godot projects in a directory'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_project_info' or 'update_project_uids', which might also involve project-related operations, so it doesn't reach the highest 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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, exclusions, or compare to siblings like 'get_project_info' for detailed project data or 'run_project' for execution, leaving the agent to infer usage context.

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