Skip to main content
Glama

trim_clip_by_frames

Adjust video or audio clip boundaries in Premiere Pro by adding or removing frames from the start or end point.

Instructions

Trim or extend the in/out point of a video or audio clip by a number of frames.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sequenceIdYesIndex of the sequence (0-based)
clipIdYesID of the clip to trim
framesDeltaYesNumber of frames to trim (positive or negative)
directionYesWhich edit point to trim ('in' or 'out')
trackTypeYesTrack type ('video' or 'audio')

Implementation Reference

  • The handler for the 'trim_clip_by_frames' tool. It extracts parameters from the input arguments, calls the runExtendScriptFile helper to execute the corresponding ExtendScript (trimClipByFrames.jsx), and returns success or error response.
    case 'trim_clip_by_frames': {
      // Dynamically import and call the ExtendScript function
      const { sequenceId, clipId, framesDelta, direction, trackType } = args;
      // Here you would use your existing bridge to call the ExtendScript file
      // For demonstration, we'll assume a function runExtendScriptFile exists
      const { runExtendScriptFile } = require('./runExtendScriptFile');
      const result = await runExtendScriptFile('trimClipByFrames.jsx', 'trimClipByFrames', [sequenceId, clipId, framesDelta, direction, trackType]);
      if (result && result.success) {
        return {
          content: [
            { type: 'text', text: `✅ Clip trimmed successfully.` }
          ]
        };
      } else {
        return {
          content: [
            { type: 'text', text: `❌ Failed to trim clip: ${result && result.error ? result.error : 'Unknown error'}` }
          ],
          isError: true
        };
      }
    }
  • Input schema defining the parameters and types for the trim_clip_by_frames tool.
    inputSchema: {
      type: "object",
      properties: {
        sequenceId: { type: "number", description: "Index of the sequence (0-based)" },
        clipId: { type: "string", description: "ID of the clip to trim" },
        framesDelta: { type: "number", description: "Number of frames to trim (positive or negative)" },
        direction: { type: "string", enum: ["in", "out"], description: "Which edit point to trim ('in' or 'out')" },
        trackType: { type: "string", enum: ["video", "audio"], description: "Track type ('video' or 'audio')" }
      },
      required: ["sequenceId", "clipId", "framesDelta", "direction", "trackType"]
    }
  • mcp-server.js:146-160 (registration)
    Registration of the trim_clip_by_frames tool in the ListTools response, including name, description, and schema.
    {
      name: "trim_clip_by_frames",
      description: "Trim or extend the in/out point of a video or audio clip by a number of frames.",
      inputSchema: {
        type: "object",
        properties: {
          sequenceId: { type: "number", description: "Index of the sequence (0-based)" },
          clipId: { type: "string", description: "ID of the clip to trim" },
          framesDelta: { type: "number", description: "Number of frames to trim (positive or negative)" },
          direction: { type: "string", enum: ["in", "out"], description: "Which edit point to trim ('in' or 'out')" },
          trackType: { type: "string", enum: ["video", "audio"], description: "Track type ('video' or 'audio')" }
        },
        required: ["sequenceId", "clipId", "framesDelta", "direction", "trackType"]
      }
    },
  • Helper function called by the handler to execute the trimClipByFrames.jsx ExtendScript file. Currently implemented as a stub.
    async function runExtendScriptFile(scriptFile, functionName, args) {
      // TODO: Integrate with your CEP/host communication bridge
      // For now, just log the call and return a fake success
      console.log(`[Stub] Would call ExtendScript: ${scriptFile} -> ${functionName}(${args.join(', ')})`);
      // Simulate async call
      return { success: true };
    }
  • ExtendScript loader that evaluates and loads the trimClipByFrames.jsx file on CEP panel startup.
    csInterface.evalScript('$.evalFile("trimClipByFrames.jsx")');

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/jordanl61/premiere-pro-mcp-server'

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