import_media
Adds a media file (video, audio, image) to your Premiere Pro project by specifying the file path and optional bin name. Simplifies media import for automated workflows.
Instructions
Imports a media file (video, audio, image) into the current Premiere Pro project.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| binName | No | The name of the bin to import the media into. If not provided, it will be imported into the root. | |
| filePath | Yes | The absolute path to the media file to import |
Implementation Reference
- src/tools/index.ts:817-834 (handler)The primary MCP tool handler for 'import_media'. It calls the bridge's importMedia method, handles errors, and formats the response with success status and details.private async importMedia(filePath: string, binName?: string): Promise<any> { try { const result = await this.bridge.importMedia(filePath); return { success: true, message: `Media imported successfully`, filePath: filePath, binName: binName || 'Root', ...result }; } catch (error) { return { success: false, error: `Failed to import media: ${error instanceof Error ? error.message : String(error)}`, filePath: filePath }; } }
- src/tools/index.ts:88-94 (registration)Tool registration in getAvailableTools() array, defining the tool name, description, and input schema.name: 'import_media', description: 'Imports a media file (video, audio, image) into the current Premiere Pro project.', inputSchema: z.object({ filePath: z.string().describe('The absolute path to the media file to import'), binName: z.string().optional().describe('The name of the bin to import the media into. If not provided, it will be imported into the root.') }) },
- src/tools/index.ts:91-94 (schema)Zod input schema for validating tool arguments: filePath (required string), binName (optional string).filePath: z.string().describe('The absolute path to the media file to import'), binName: z.string().optional().describe('The name of the bin to import the media into. If not provided, it will be imported into the root.') }) },
- src/bridge/index.ts:229-247 (handler)Low-level bridge handler that executes ExtendScript to import the media file into the Premiere Pro project and returns project item details.async importMedia(filePath: string): Promise<PremiereProProjectItem> { const script = ` // Import media file var file = new File("${filePath}"); var importedItem = app.project.importFiles([file.fsName]); // Return imported item info JSON.stringify({ id: importedItem.nodeId, name: importedItem.name, type: importedItem.type, mediaPath: importedItem.getMediaPath(), duration: importedItem.getOutPoint() - importedItem.getInPoint(), frameRate: importedItem.getVideoFrameRate() }); `; return await this.executeScript(script); }