list_project_items
Discover and list all media items, bins, and assets in your Premiere Pro project. Use this to organize and access project resources efficiently before performing edits or operations.
Instructions
Lists all media items, bins, and assets in the current Premiere Pro project. Use this to discover available media before performing operations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeBins | No | Whether to include bin information in the results | |
| includeMetadata | No | Whether to include detailed metadata for each item |
Implementation Reference
- src/tools/index.ts:540-590 (handler)Core handler function for 'list_project_items' tool. Constructs ExtendScript to traverse project rootItem children, collects items and bins with optional metadata, returns structured JSON.private async listProjectItems(includeBins = true, includeMetadata = false): Promise<any> { const script = ` try { var items = []; var bins = []; // List all project items for (var i = 0; i < app.project.rootItem.children.numItems; i++) { var item = app.project.rootItem.children[i]; var itemInfo = { id: item.nodeId, name: item.name, type: item.type.toString(), path: item.getMediaPath(), duration: item.duration ? item.duration.seconds : null }; if (${includeMetadata}) { itemInfo.metadata = { width: item.getMediaWidth ? item.getMediaWidth() : null, height: item.getMediaHeight ? item.getMediaHeight() : null, frameRate: item.getMediaFrameRate ? item.getMediaFrameRate() : null, hasVideo: item.hasVideo ? item.hasVideo() : false, hasAudio: item.hasAudio ? item.hasAudio() : false }; } if (item.type === ProjectItemType.BIN) { bins.push(itemInfo); } else { items.push(itemInfo); } } JSON.stringify({ success: true, items: items, bins: ${includeBins} ? bins : [], totalItems: items.length, totalBins: bins.length }); } catch (e) { JSON.stringify({ success: false, error: e.toString() }); } `; return await this.bridge.executeScript(script); }
- src/tools/index.ts:31-37 (schema)Input schema and tool definition for 'list_project_items' in getAvailableTools().name: 'list_project_items', description: 'Lists all media items, bins, and assets in the current Premiere Pro project. Use this to discover available media before performing operations.', inputSchema: z.object({ includeBins: z.boolean().optional().describe('Whether to include bin information in the results'), includeMetadata: z.boolean().optional().describe('Whether to include detailed metadata for each item') }) },
- src/tools/index.ts:426-428 (registration)Dispatch/registration in executeTool() switch statement that calls the handler.case 'list_project_items': return await this.listProjectItems(args.includeBins, args.includeMetadata); case 'list_sequences':
- src/index.ts:74-81 (registration)MCP server registration: ListToolsRequestHandler calls getAvailableTools() to expose the tool including schema.this.server.setRequestHandler(ListToolsRequestSchema, async () => { const tools = this.tools.getAvailableTools().map((tool) => ({ name: tool.name, description: tool.description, inputSchema: zodToJsonSchema(tool.inputSchema, { $refStrategy: 'none' }) })); return { tools }; });
- src/index.ts:84-106 (handler)MCP CallTool handler that invokes tools.executeTool for the tool execution.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const result = await this.tools.executeTool(name, args || {}); return { content: [ { type: 'text' as const, text: JSON.stringify(result, null, 2) } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; this.logger.error(`Tool execution failed: ${errorMessage}`); throw new McpError( ErrorCode.InternalError, `Failed to execute tool '${name}': ${errorMessage}` ); } });