add_shape
Adds customizable shapes like rectangles, circles, or triangles to Adobe Premiere Pro timelines, specifying type, size, color, position, duration, and track placement for precise video editing.
Instructions
Adds a shape (rectangle, circle, etc.) to the timeline.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | The hex color code for the shape | |
| duration | Yes | How long the shape should remain on screen in seconds | |
| position | No | Shape position on screen | |
| sequenceId | Yes | The sequence to add the shape to | |
| shapeType | Yes | The type of shape to add | |
| size | No | Shape size | |
| startTime | Yes | The time in seconds when the shape should appear | |
| trackIndex | Yes | The video track to place the shape on |
Implementation Reference
- src/tools/index.ts:280-298 (schema)Zod input schema for the 'add_shape' tool, defining parameters like shapeType, sequenceId, trackIndex, startTime, duration, and optional properties for color, size, and position.name: 'add_shape', description: 'Adds a shape (rectangle, circle, etc.) to the timeline.', inputSchema: z.object({ shapeType: z.enum(['rectangle', 'circle', 'triangle']).describe('The type of shape to add'), sequenceId: z.string().describe('The sequence to add the shape to'), trackIndex: z.number().describe('The video track to place the shape on'), startTime: z.number().describe('The time in seconds when the shape should appear'), duration: z.number().describe('How long the shape should remain on screen in seconds'), color: z.string().optional().describe('The hex color code for the shape'), size: z.object({ width: z.number().optional().describe('Width in pixels'), height: z.number().optional().describe('Height in pixels') }).optional().describe('Shape size'), position: z.object({ x: z.number().optional().describe('Horizontal position (0-100)'), y: z.number().optional().describe('Vertical position (0-100)') }).optional().describe('Shape position on screen') }) },
- src/tools/index.ts:495-495 (registration)Dispatch/registration of the 'add_shape' tool handler in the executeTool switch statement.return await this.addShape(args);
- src/tools/index.ts:1581-1648 (handler)The main handler function for 'add_shape' tool. It generates and executes an ExtendScript via the PremiereProBridge to create a shape using the title system, configure its properties, and insert it as a clip into the specified sequence track and time.private async addShape(args: any): Promise<any> { const script = ` try { var sequence = app.project.getSequenceByID("${args.sequenceId}"); if (!sequence) { JSON.stringify({ success: false, error: "Sequence not found" }); return; } var track = sequence.videoTracks[${args.trackIndex}]; if (!track) { JSON.stringify({ success: false, error: "Video track not found" }); return; } // Create a shape using the legacy title system var shapeItem = app.project.createNewTitle("Shape"); if (!shapeItem) { JSON.stringify({ success: false, error: "Failed to create shape" }); return; } // Add shape to title var shape = shapeItem.addShape("${args.shapeType}"); if (shape) { ${args.color ? `shape.fillColor = "${args.color}";` : ''} ${args.size ? ` shape.width = ${args.size.width || 100}; shape.height = ${args.size.height || 100}; ` : ''} ${args.position ? ` shape.x = ${args.position.x || 50}; shape.y = ${args.position.y || 50}; ` : ''} } // Insert the shape into the timeline var shapeClip = track.insertClip(shapeItem, new Time("${args.startTime}s")); shapeClip.end = new Time(shapeClip.start.seconds + ${args.duration}); JSON.stringify({ success: true, message: "Shape added successfully", shapeType: "${args.shapeType}", clipId: shapeClip.nodeId, startTime: ${args.startTime}, duration: ${args.duration}, trackIndex: ${args.trackIndex} }); } catch (e) { JSON.stringify({ success: false, error: e.toString() }); } `; return await this.bridge.executeScript(script); }