Skip to main content
Glama

import_folder

Import all media files from a folder into your Premiere Pro project, organizing them in a specified bin with optional subfolder scanning.

Instructions

Imports all media files from a folder into the current Premiere Pro project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderPathYesThe absolute path to the folder containing media files
binNameNoThe name of the bin to import the media into
recursiveNoWhether to import from subfolders recursively

Implementation Reference

  • The main handler function for the 'import_folder' tool. It generates and executes an ExtendScript that recursively imports media files from the specified folder into the Premiere Pro project root or a named bin, collecting imported items and errors.
    private async importFolder(folderPath: string, binName?: string, recursive = false): Promise<any> { const script = ` try { var folder = new Folder("${folderPath}"); var importedItems = []; var errors = []; function importFiles(dir, targetBin) { var files = dir.getFiles(); for (var i = 0; i < files.length; i++) { var file = files[i]; if (file instanceof File) { try { var item = targetBin.importFiles([file.fsName]); if (item && item.length > 0) { importedItems.push({ name: file.name, path: file.fsName, id: item[0].nodeId }); } } catch (e) { errors.push({ file: file.name, error: e.toString() }); } } else if (file instanceof Folder && ${recursive}) { importFiles(file, targetBin); } } } var targetBin = app.project.rootItem; ${binName ? `targetBin = app.project.rootItem.children["${binName}"] || app.project.rootItem;` : ''} importFiles(folder, targetBin); JSON.stringify({ success: true, importedItems: importedItems, errors: errors, totalImported: importedItems.length, totalErrors: errors.length }); } catch (e) { JSON.stringify({ success: false, error: e.toString() }); } `; return await this.bridge.executeScript(script); }
  • Zod schema defining the input parameters for the 'import_folder' tool: folderPath (required string), binName (optional string), recursive (optional boolean).
    inputSchema: z.object({ folderPath: z.string().describe('The absolute path to the folder containing media files'), binName: z.string().optional().describe('The name of the bin to import the media into'), recursive: z.boolean().optional().describe('Whether to import from subfolders recursively') })
  • Registration of the 'import_folder' tool in the getAvailableTools() array, providing name, description, and input schema.
    { name: 'import_folder', description: 'Imports all media files from a folder into the current Premiere Pro project.', inputSchema: z.object({ folderPath: z.string().describe('The absolute path to the folder containing media files'), binName: z.string().optional().describe('The name of the bin to import the media into'), recursive: z.boolean().optional().describe('Whether to import from subfolders recursively') }) },
  • Dispatch case in executeTool() method that routes 'import_folder' calls to the importFolder handler.
    case 'import_folder': return await this.importFolder(args.folderPath, args.binName, args.recursive);

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/hetpatel-11/Adobe_Premiere_Pro_MCP'

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