Skip to main content
Glama

folder_list

Retrieve and display folder contents within a Unity project using specified path and recursive options for subdirectory listing.

Instructions

List contents of a folder in Unity project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoPath of the folder to list (default: Assets)
recursiveNoList all subdirectories recursively (default: false)

Implementation Reference

  • Executes the 'folder_list' tool: validates args implicitly, calls adapter.listFolder, formats entries with icons and paths, returns formatted text content
    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)'}` }] }; }
  • Registers the 'folder_list' tool in getTools() with name, description, and input schema
    { 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)' } } } }
  • TypeScript interface defining the structure of folder entries returned by the listFolder operation
    export interface FolderEntry { path: string; name: string; type: 'file' | 'folder'; extension?: string; guid: string; }
  • Helper method in UnityHttpAdapter that invokes the Unity HTTP endpoint 'folder/list' via generic call method
    async listFolder(path?: string, recursive: boolean = false): Promise<{ path: string; entries: FolderEntry[] }> { return this.call('folder/list', { path, recursive }); }
  • Registers the generic MCP tool execution handler that dispatches to UnityMcpTools.executeTool based on tool name (covers folder_list)
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => { return this.tools.executeTool(request.params.name, request.params.arguments || {}); });

Other Tools

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

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