Skip to main content
Glama

folder_move

Move folders within Unity projects to reorganize assets and manage project structure by specifying source and target paths.

Instructions

Move a folder to a new location in Unity project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourcePathYesCurrent path of the folder
targetPathYesTarget path for the folder

Implementation Reference

  • Handler function in executeTool that validates input parameters, calls the adapter's moveFolder method, and returns a success message with details.
    case 'folder_move': {
      if (!args.sourcePath || !args.targetPath) {
        throw new Error('sourcePath and targetPath are required');
      }
      const result = await this.adapter.moveFolder(args.sourcePath, args.targetPath);
      return {
        content: [{
          type: 'text',
          text: `Folder moved successfully:\nFrom: ${result.sourcePath}\nTo: ${result.targetPath}\nGUID: ${result.guid}`
        }]
      };
    }
  • Tool schema definition including name, description, and input schema for validation.
    {
      name: 'folder_move',
      description: 'Move a folder to a new location in Unity project',
      inputSchema: {
        type: 'object',
        properties: {
          sourcePath: {
            type: 'string',
            description: 'Current path of the folder'
          },
          targetPath: {
            type: 'string',
            description: 'Target path for the folder'
          }
        },
        required: ['sourcePath', 'targetPath']
      }
    },
  • Registration of all tools including folder_move in the getTools() method which returns the array of Tool objects.
    getTools(): Tool[] {
      return [
        // Script tools
        {
          name: 'script_create',
          description: 'Create a new C# script in Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              fileName: {
                type: 'string',
                description: 'Name of the script file (without .cs extension)'
              },
              content: {
                type: 'string',
                description: 'Script content (optional, will use template if not provided)'
              },
              folder: {
                type: 'string',
                description: 'Target folder path (default: Assets/Scripts)'
              }
            },
            required: ['fileName']
          }
        },
        {
          name: 'script_read',
          description: 'Read a C# script from Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              path: {
                type: 'string',
                description: 'Path to the script file'
              }
            },
            required: ['path']
          }
        },
        {
          name: 'script_delete',
          description: 'Delete a C# script from Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              path: {
                type: 'string',
                description: 'Path to the script file'
              }
            },
            required: ['path']
          }
        },
        {
          name: 'script_apply_diff',
          description: 'Apply a unified diff to a C# script',
          inputSchema: {
            type: 'object',
            properties: {
              path: {
                type: 'string',
                description: 'Path to the script file'
              },
              diff: {
                type: 'string',
                description: 'Unified diff content to apply'
              },
              options: {
                type: 'object',
                description: 'Optional diff application settings',
                properties: {
                  dryRun: {
                    type: 'boolean',
                    description: 'Preview changes without applying (default: false)'
                  }
                }
              }
            },
            required: ['path', 'diff']
          }
        },
        
        // Shader tools
        {
          name: 'shader_create',
          description: 'Create a new shader in Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              name: {
                type: 'string',
                description: 'Name of the shader (without .shader extension)'
              },
              content: {
                type: 'string',
                description: 'Shader content (optional, will use template if not provided)'
              },
              folder: {
                type: 'string',
                description: 'Target folder path (default: Assets/Shaders)'
              }
            },
            required: ['name']
          }
        },
        {
          name: 'shader_read',
          description: 'Read a shader from Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              path: {
                type: 'string',
                description: 'Path to the shader file'
              }
            },
            required: ['path']
          }
        },
        {
          name: 'shader_delete',
          description: 'Delete a shader from Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              path: {
                type: 'string',
                description: 'Path to the shader file'
              }
            },
            required: ['path']
          }
        },
        
        // Project tools
        {
          name: 'project_info',
          description: 'Get comprehensive Unity project information including render pipeline details, project path, Unity version, and platform info',
          inputSchema: {
            type: 'object',
            properties: {}
          }
        },
        {
          name: 'project_status',
          description: 'Check Unity MCP server connection status (simple connectivity test only)',
          inputSchema: {
            type: 'object',
            properties: {}
          }
        },
        {
          name: 'setup_unity_bridge',
          description: 'Install/update Unity MCP bridge scripts to a Unity project (works even if Unity server is not running)',
          inputSchema: {
            type: 'object',
            properties: {
              projectPath: {
                type: 'string',
                description: 'Path to the Unity project'
              },
              forceUpdate: {
                type: 'boolean',
                description: 'Force update even if scripts are up to date',
                default: false
              }
            },
            required: ['projectPath']
          }
        },
        
        // Folder tools
        {
          name: 'folder_create',
          description: 'Create a new folder in Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              path: {
                type: 'string',
                description: 'Path for the new folder (e.g., Assets/MyFolder)'
              }
            },
            required: ['path']
          }
        },
        {
          name: 'folder_rename',
          description: 'Rename a folder in Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              oldPath: {
                type: 'string',
                description: 'Current path of the folder'
              },
              newName: {
                type: 'string',
                description: 'New name for the folder'
              }
            },
            required: ['oldPath', 'newName']
          }
        },
        {
          name: 'folder_move',
          description: 'Move a folder to a new location in Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              sourcePath: {
                type: 'string',
                description: 'Current path of the folder'
              },
              targetPath: {
                type: 'string',
                description: 'Target path for the folder'
              }
            },
            required: ['sourcePath', 'targetPath']
          }
        },
        {
          name: 'folder_delete',
          description: 'Delete a folder from Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              path: {
                type: 'string',
                description: 'Path of the folder to delete'
              },
              recursive: {
                type: 'boolean',
                description: 'Delete all contents recursively (default: true)'
              }
            },
            required: ['path']
          }
        },
        {
          name: 'folder_list',
          description: 'List contents of a folder in Unity project',
          inputSchema: {
            type: 'object',
            properties: {
              path: {
                type: 'string',
                description: 'Path of the folder to list (default: Assets)'
              },
              recursive: {
                type: 'boolean',
                description: 'List all subdirectories recursively (default: false)'
              }
            }
          }
        }
      ];
  • Helper method in UnityHttpAdapter that performs the HTTP call to Unity server for moving a folder.
    async moveFolder(sourcePath: string, targetPath: string): Promise<{ sourcePath: string; targetPath: string; guid: string }> {
      return this.call('folder/move', { sourcePath, targetPath });
    }

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/zabaglione/mcp-server-unity'

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