import_media
Import local media. Use action="from_editor" with explicit projectId and timelineId when an authenticated browser on the helper machine is connected. Omit browserProfileId for automatic selection; never ask the user to choose. The visible page and timeline do not change. Serve the file with the plugin's serve-local-media.mjs and pass its assetId, url, filename and sizeBytes. Reuse the same assetId on retries. This imports to the library through the editor pipeline without page scripting or shell upload credentials, using the same large-video upload policy as the editor file picker. Large original video uploads may be deferred until cloud bytes are needed; check browse_assets before waiting for upload. Success means local bytes are persisted and the asset is registered in the editor; cloud upload, server sync and transcription may still be pending. Keep the authenticated browser open. Never use loopback URLs from a remote sandbox.
For multiple loopback files, make ONE call with action="from_editor" and files:[{assetId,url,filename,sizeBytes}, ...] (1–16 entries). Each file may use its own helper address. Do not combine files with the top-level single-file fields. The batch admits at most four imports at a time, matching the normal editor import limit and returns ordered results with each assetId, filename, ok and status/error, plus succeeded/failed counts. Partial success is preserved; retry only failed entries with their SAME assetIds. The single-file top-level form remains supported. Relinking also accepts files, using existing assetIds with action="relink_from_editor".
When no same-machine editor is available or browser local-network access is blocked, use action="create_session" for the upload-helper fallback.
For reference-only imports, use action="create_session" with mediaPoolVisibility:"hidden". This applies to every file uploaded with that session: agents can discover and inspect them, but users cannot see them in their media library. Omit it for user uploads, source footage, and generated deliverables. This flag is not supported for from_editor or relink_from_editor.
To restore missing local bytes for an existing asset, use action="relink_from_editor" with the EXISTING asset's id and the helper's url, filename and sizeBytes. Pass the id exactly as browse_assets or inspect_asset printed it: the compact 10-hex form is accepted here and resolved against this project, as is the full UUID. Do not mint a new id for a relink. This preserves timeline references and uses the editor's normal relink pipeline. Supply the corresponding original media, not a different edit or replacement clip. Success returns status="locally_relinked" after local persistence; upload and transcription may still be pending. Relink requires a compatible authenticated browser and does not create another asset. The editor fetches the helper URL from the browser showing it, so an agent in-app browser that blocks loopback requests (ERR_BLOCKED_BY_CLIENT) fails every attempt: do not retry, and tell the user to relink in their normal browser or in ChatCut Desktop, since relink has no upload-based fallback.
For the upload fallback, call this once with action="create_session", then run the plugin helper with at most four files. For more files, create a fresh session for each batch of four. The helper uploads frontend-aligned bytes straight to storage, keeping them off the ChatCut backend, and prints registered assetIds. Registered assetIds are usable for timeline placement, rough cuts, organization, and transcript-driven planning. For most editing tasks, wait only for target:"transcription" before transcript/caption/script-aware work. Do not wait for target:"upload" preemptively: an open editor can inspect local/blob frames, and Desktop-local preview and export do not require cloud upload. Check target:"upload" only after the next operation explicitly says it needs a cloud-readable remoteUrl, such as request_asset_download or a cloud-only render path. If the upload helper fails, give the user the returned userUploadFallback.url so they can upload into this project in their browser. Do not manually construct metadata.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "import_media"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | ||
| files | No | Batch loopback import/relink. Use instead of the top-level assetId, url, filename and sizeBytes. | |
| action | Yes | ||
| assetId | No | For action="from_editor", a fresh UUID you mint and reuse on retry. For action="relink_from_editor", the existing asset's id from browse_assets, full or 10-hex. | |
| filename | No | ||
| projectId | No | Full project UUID. Required for external browser work; internal agents may omit. Execution/explicit-timeline calls never change later calls' target. | |
| sizeBytes | No | ||
| timelineId | No | Full timeline UUID, not a prefix. Required for browser work, even unplaced assets. Get it from read_project or manage_timelines action="list". Never switches visible timeline. | |
| idempotencyKey | No | Stable key for this browser execution. Reuse only with identical scope and parameters after a lost acknowledgement; applies only to this call. | |
| browserProfileId | No | Optional browser profile override. Omit to select automatically; do not ask the user to choose. | |
| mediaPoolVisibility | No | create_session only: reference-only assets hidden from the user's media library, still available to agents by ID. Applies to the entire session. |