folder_list
List files and subdirectories within Unity project folders to manage assets and navigate project structure. Specify a path and choose recursive listing for comprehensive directory exploration.
Instructions
List contents of a folder in Unity project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path of the folder to list (default: Assets) | |
| recursive | No | List all subdirectories recursively (default: false) |
Implementation Reference
- src/tools/unity-mcp-tools.ts:525-539 (handler)Handler for the 'folder_list' tool. Calls the adapter's listFolder method with provided path and recursive parameters, then formats the directory entries with icons (๐ for folders, ๐ for files) and path information, returning a formatted text response.case 'folder_list': { const result = await this.adapter.listFolder(args.path, args.recursive); const entries = result.entries.map(e => { const prefix = e.type === 'folder' ? '๐' : '๐'; const info = e.type === 'file' ? ` (${e.extension})` : ''; return `${prefix} ${e.name}${info} - ${e.path}`; }).join('\n'); return { content: [{ type: 'text', text: `Contents of ${result.path}:\n\n${entries || '(empty)'}` }] }; }
- src/tools/unity-mcp-tools.ts:300-316 (registration)Registration of the 'folder_list' tool in the getTools() method, including name, description, and input schema definition.{ 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)' } } } }
- src/tools/unity-mcp-tools.ts:303-316 (schema)Input schema for the folder_list tool defining parameters: path (string, optional, default Assets) and recursive (boolean, optional, default false).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 implements listFolder by making an HTTP POST call to Unity server endpoint 'folder/list' with path and recursive parameters.async listFolder(path?: string, recursive: boolean = false): Promise<{ path: string; entries: FolderEntry[] }> { return this.call('folder/list', { path, recursive }); }
- Type definition for FolderEntry used in listFolder response, defining structure of directory listing entries.export interface FolderEntry { path: string; name: string; type: 'file' | 'folder'; extension?: string; guid: string; }