davinci-resolve-mcp 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/AGENTS.md +85 -0
  2. package/CHANGELOG.md +802 -0
  3. package/CLAUDE.md +15 -0
  4. package/LICENSE +21 -0
  5. package/README.md +159 -0
  6. package/SECURITY.md +53 -0
  7. package/bin/davinci-resolve-mcp.mjs +376 -0
  8. package/docs/README.md +56 -0
  9. package/docs/SKILL.md +1145 -0
  10. package/docs/authoring/fuse-dctl-authoring.md +242 -0
  11. package/docs/authoring/script-plugin-authoring.md +195 -0
  12. package/docs/contributing.md +82 -0
  13. package/docs/guides/color-decision-guide.md +387 -0
  14. package/docs/guides/editorial-decision-guide.md +136 -0
  15. package/docs/guides/media-analysis-guide.md +615 -0
  16. package/docs/guides/multicam-setup-guide.md +138 -0
  17. package/docs/install.md +198 -0
  18. package/docs/integrations/workflow-integrations.md +120 -0
  19. package/docs/kernels/README.md +28 -0
  20. package/docs/kernels/audio-fairlight-kernel.md +86 -0
  21. package/docs/kernels/color-grade-kernel.md +103 -0
  22. package/docs/kernels/extension-authoring-kernel.md +101 -0
  23. package/docs/kernels/fusion-composition-kernel.md +91 -0
  24. package/docs/kernels/media-pool-ingest-kernel.md +147 -0
  25. package/docs/kernels/project-lifecycle-kernel.md +120 -0
  26. package/docs/kernels/render-deliver-kernel.md +92 -0
  27. package/docs/kernels/review-annotation-kernel.md +110 -0
  28. package/docs/kernels/timeline-conform-interchange-kernel.md +99 -0
  29. package/docs/kernels/timeline-edit-kernel.md +189 -0
  30. package/docs/notes/codec-plugin-notes.md +136 -0
  31. package/docs/notes/dctl-notes.md +234 -0
  32. package/docs/notes/fusion-template-notes.md +136 -0
  33. package/docs/notes/lut-notes.md +136 -0
  34. package/docs/notes/openfx-notes.md +120 -0
  35. package/docs/process/release-process.md +152 -0
  36. package/docs/reference/api-coverage.md +488 -0
  37. package/docs/reference/resolve_scripting_api.txt +1012 -0
  38. package/examples/README.md +53 -0
  39. package/examples/markers/README.md +81 -0
  40. package/examples/media/README.md +94 -0
  41. package/examples/timeline/README.md +98 -0
  42. package/install.py +1196 -0
  43. package/package.json +52 -0
  44. package/scripts/audit_api_parity.py +275 -0
  45. package/scripts/live_media_analysis_polish_probe.py +65 -0
  46. package/src/__init__.py +3 -0
  47. package/src/analysis_dashboard.py +4936 -0
  48. package/src/control_panel.py +13 -0
  49. package/src/granular/__init__.py +17 -0
  50. package/src/granular/common.py +727 -0
  51. package/src/granular/folder.py +287 -0
  52. package/src/granular/gallery.py +306 -0
  53. package/src/granular/graph.py +309 -0
  54. package/src/granular/media_pool.py +679 -0
  55. package/src/granular/media_pool_item.py +852 -0
  56. package/src/granular/media_storage.py +179 -0
  57. package/src/granular/project.py +1594 -0
  58. package/src/granular/resolve_control.py +521 -0
  59. package/src/granular/timeline.py +1074 -0
  60. package/src/granular/timeline_item.py +2251 -0
  61. package/src/resolve_mcp_server.py +43 -0
  62. package/src/server.py +15691 -0
  63. package/src/utils/__init__.py +3 -0
  64. package/src/utils/app_control.py +319 -0
  65. package/src/utils/audio_fairlight_live_probe.py +263 -0
  66. package/src/utils/cdl.py +20 -0
  67. package/src/utils/cloud_operations.py +192 -0
  68. package/src/utils/color_grade_live_probe.py +444 -0
  69. package/src/utils/dctl_templates.py +368 -0
  70. package/src/utils/extension_authoring_live_probe.py +292 -0
  71. package/src/utils/fuse_templates.py +1968 -0
  72. package/src/utils/fusion_composition_live_probe.py +284 -0
  73. package/src/utils/layout_presets.py +333 -0
  74. package/src/utils/mcp_stdio.py +32 -0
  75. package/src/utils/media_analysis.py +3618 -0
  76. package/src/utils/media_analysis_jobs.py +796 -0
  77. package/src/utils/media_pool_ingest_live_probe.py +592 -0
  78. package/src/utils/multicam.py +393 -0
  79. package/src/utils/object_inspection.py +287 -0
  80. package/src/utils/platform.py +157 -0
  81. package/src/utils/project_lifecycle_live_probe.py +376 -0
  82. package/src/utils/project_properties.py +601 -0
  83. package/src/utils/render_deliver_live_probe.py +384 -0
  84. package/src/utils/resolve_connection.py +77 -0
  85. package/src/utils/review_annotation_live_probe.py +352 -0
  86. package/src/utils/script_templates.py +1193 -0
  87. package/src/utils/sync_detection.py +887 -0
  88. package/src/utils/timeline_conform_live_probe.py +280 -0
  89. package/src/utils/timeline_kernel_live_probe.py +1091 -0
  90. package/src/utils/timeline_kernel_probe.py +185 -0
  91. package/src/utils/timeline_title_text.py +87 -0
  92. package/src/utils/update_check.py +610 -0
@@ -0,0 +1,852 @@
1
+ """MediaPoolItem operations and metadata helpers."""
2
+
3
+ from src.granular.common import * # noqa: F401,F403
4
+
5
+ resolve = ResolveProxy()
6
+
7
+ @mcp.tool(annotations=EXTERNAL_DESTRUCTIVE_TOOL)
8
+ def link_proxy_media(clip_name: str, proxy_file_path: str) -> str:
9
+ """Link a proxy media file to a clip.
10
+
11
+ Args:
12
+ clip_name: Name of the clip to link proxy to
13
+ proxy_file_path: Path to the proxy media file
14
+ """
15
+ pm, current_project = get_current_project()
16
+ if not current_project:
17
+ return "Error: No project currently open"
18
+
19
+ media_pool = current_project.GetMediaPool()
20
+ if not media_pool:
21
+ return "Error: Failed to get Media Pool"
22
+
23
+ # Find the clip by name
24
+ clips = get_all_media_pool_clips(media_pool)
25
+ target_clip = None
26
+
27
+ for clip in clips:
28
+ if clip.GetName() == clip_name:
29
+ target_clip = clip
30
+ break
31
+
32
+ if not target_clip:
33
+ return f"Error: Clip '{clip_name}' not found in Media Pool"
34
+
35
+ # Check if file exists
36
+ if not os.path.exists(proxy_file_path):
37
+ return f"Error: Proxy file '{proxy_file_path}' does not exist"
38
+
39
+ try:
40
+ result = target_clip.LinkProxyMedia(proxy_file_path)
41
+ if result:
42
+ return f"Successfully linked proxy media '{proxy_file_path}' to clip '{clip_name}'"
43
+ else:
44
+ return f"Failed to link proxy media to clip '{clip_name}'"
45
+ except Exception as e:
46
+ return f"Error linking proxy media: {str(e)}"
47
+
48
+
49
+ @mcp.tool()
50
+ def unlink_proxy_media(clip_name: str) -> str:
51
+ """Unlink proxy media from a clip.
52
+
53
+ Args:
54
+ clip_name: Name of the clip to unlink proxy from
55
+ """
56
+ pm, current_project = get_current_project()
57
+ if not current_project:
58
+ return "Error: No project currently open"
59
+
60
+ media_pool = current_project.GetMediaPool()
61
+ if not media_pool:
62
+ return "Error: Failed to get Media Pool"
63
+
64
+ # Find the clip by name
65
+ clips = get_all_media_pool_clips(media_pool)
66
+ target_clip = None
67
+
68
+ for clip in clips:
69
+ if clip.GetName() == clip_name:
70
+ target_clip = clip
71
+ break
72
+
73
+ if not target_clip:
74
+ return f"Error: Clip '{clip_name}' not found in Media Pool"
75
+
76
+ try:
77
+ result = target_clip.UnlinkProxyMedia()
78
+ if result:
79
+ return f"Successfully unlinked proxy media from clip '{clip_name}'"
80
+ else:
81
+ return f"Failed to unlink proxy media from clip '{clip_name}'"
82
+ except Exception as e:
83
+ return f"Error unlinking proxy media: {str(e)}"
84
+
85
+
86
+ @mcp.tool()
87
+ def replace_clip(clip_name: str, replacement_path: str) -> str:
88
+ """Replace a clip with another media file.
89
+
90
+ Args:
91
+ clip_name: Name of the clip to be replaced
92
+ replacement_path: Path to the replacement media file
93
+ """
94
+ pm, current_project = get_current_project()
95
+ if not current_project:
96
+ return "Error: No project currently open"
97
+
98
+ media_pool = current_project.GetMediaPool()
99
+ if not media_pool:
100
+ return "Error: Failed to get Media Pool"
101
+
102
+ # Find the clip by name
103
+ clips = get_all_media_pool_clips(media_pool)
104
+ target_clip = None
105
+
106
+ for clip in clips:
107
+ if clip.GetName() == clip_name:
108
+ target_clip = clip
109
+ break
110
+
111
+ if not target_clip:
112
+ return f"Error: Clip '{clip_name}' not found in Media Pool"
113
+
114
+ # Check if file exists
115
+ if not os.path.exists(replacement_path):
116
+ return f"Error: Replacement file '{replacement_path}' does not exist"
117
+
118
+ try:
119
+ result = target_clip.ReplaceClip(replacement_path)
120
+ if result:
121
+ return f"Successfully replaced clip '{clip_name}' with '{replacement_path}'"
122
+ else:
123
+ return f"Failed to replace clip '{clip_name}'"
124
+ except Exception as e:
125
+ return f"Error replacing clip: {str(e)}"
126
+
127
+
128
+ @mcp.tool()
129
+ def transcribe_audio(clip_name: str, language: str = "en-US") -> str:
130
+ """Transcribe audio for a clip.
131
+
132
+ Args:
133
+ clip_name: Name of the clip to transcribe
134
+ language: Language code for transcription (default: en-US)
135
+ """
136
+ pm, current_project = get_current_project()
137
+ if not current_project:
138
+ return "Error: No project currently open"
139
+
140
+ media_pool = current_project.GetMediaPool()
141
+ if not media_pool:
142
+ return "Error: Failed to get Media Pool"
143
+
144
+ # Find the clip by name
145
+ clips = get_all_media_pool_clips(media_pool)
146
+ target_clip = None
147
+
148
+ for clip in clips:
149
+ if clip.GetName() == clip_name:
150
+ target_clip = clip
151
+ break
152
+
153
+ if not target_clip:
154
+ return f"Error: Clip '{clip_name}' not found in Media Pool"
155
+
156
+ try:
157
+ result = target_clip.TranscribeAudio(language)
158
+ if result:
159
+ return f"Successfully started audio transcription for clip '{clip_name}' in language '{language}'"
160
+ else:
161
+ return f"Failed to start audio transcription for clip '{clip_name}'"
162
+ except Exception as e:
163
+ return f"Error during audio transcription: {str(e)}"
164
+
165
+
166
+ @mcp.tool()
167
+ def clear_transcription(clip_name: str) -> str:
168
+ """Clear audio transcription for a clip.
169
+
170
+ Args:
171
+ clip_name: Name of the clip to clear transcription from
172
+ """
173
+ pm, current_project = get_current_project()
174
+ if not current_project:
175
+ return "Error: No project currently open"
176
+
177
+ media_pool = current_project.GetMediaPool()
178
+ if not media_pool:
179
+ return "Error: Failed to get Media Pool"
180
+
181
+ # Find the clip by name
182
+ clips = get_all_media_pool_clips(media_pool)
183
+ target_clip = None
184
+
185
+ for clip in clips:
186
+ if clip.GetName() == clip_name:
187
+ target_clip = clip
188
+ break
189
+
190
+ if not target_clip:
191
+ return f"Error: Clip '{clip_name}' not found in Media Pool"
192
+
193
+ try:
194
+ result = target_clip.ClearTranscription()
195
+ if result:
196
+ return f"Successfully cleared audio transcription for clip '{clip_name}'"
197
+ else:
198
+ return f"Failed to clear audio transcription for clip '{clip_name}'"
199
+ except Exception as e:
200
+ return f"Error clearing audio transcription: {str(e)}"
201
+
202
+
203
+ @mcp.tool()
204
+ def get_clip_metadata(clip_id: str, metadata_type: str = "") -> Dict[str, Any]:
205
+ """Get metadata for a Media Pool clip.
206
+
207
+ Args:
208
+ clip_id: Unique ID of the clip.
209
+ metadata_type: Specific metadata key, or empty for all metadata.
210
+ """
211
+ _, mp, err = _get_mp()
212
+ if err:
213
+ return err
214
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
215
+ if not clip:
216
+ return {"error": f"Clip {clip_id} not found"}
217
+ if metadata_type:
218
+ result = clip.GetMetadata(metadata_type)
219
+ else:
220
+ result = clip.GetMetadata()
221
+ return {"clip_id": clip_id, "metadata": result if result else {}}
222
+
223
+
224
+ @mcp.tool()
225
+ def set_clip_metadata(clip_id: str, metadata: Dict[str, str]) -> Dict[str, Any]:
226
+ """Set metadata on a Media Pool clip.
227
+
228
+ Args:
229
+ clip_id: Unique ID of the clip.
230
+ metadata: Dict of metadata key-value pairs to set.
231
+ """
232
+ _, mp, err = _get_mp()
233
+ if err:
234
+ return err
235
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
236
+ if not clip:
237
+ return {"error": f"Clip {clip_id} not found"}
238
+ result = clip.SetMetadata(metadata)
239
+ return {"success": bool(result)}
240
+
241
+
242
+ @mcp.tool()
243
+ def get_clip_third_party_metadata(clip_id: str, metadata_key: str = "") -> Dict[str, Any]:
244
+ """Get third-party metadata for a clip.
245
+
246
+ Args:
247
+ clip_id: Unique ID of the clip.
248
+ metadata_key: Specific key, or empty for all.
249
+ """
250
+ _, mp, err = _get_mp()
251
+ if err:
252
+ return err
253
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
254
+ if not clip:
255
+ return {"error": f"Clip {clip_id} not found"}
256
+ if metadata_key:
257
+ result = clip.GetThirdPartyMetadata(metadata_key)
258
+ else:
259
+ result = clip.GetThirdPartyMetadata()
260
+ return {"clip_id": clip_id, "third_party_metadata": result if result else {}}
261
+
262
+
263
+ @mcp.tool()
264
+ def set_clip_third_party_metadata(clip_id: str, metadata: Dict[str, str]) -> Dict[str, Any]:
265
+ """Set third-party metadata on a clip.
266
+
267
+ Args:
268
+ clip_id: Unique ID of the clip.
269
+ metadata: Dict of metadata key-value pairs.
270
+ """
271
+ _, mp, err = _get_mp()
272
+ if err:
273
+ return err
274
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
275
+ if not clip:
276
+ return {"error": f"Clip {clip_id} not found"}
277
+ result = clip.SetThirdPartyMetadata(metadata)
278
+ return {"success": bool(result)}
279
+
280
+
281
+ @mcp.tool()
282
+ def get_clip_media_id(clip_id: str) -> Dict[str, Any]:
283
+ """Get the media ID for a clip.
284
+
285
+ Args:
286
+ clip_id: Unique ID of the clip.
287
+ """
288
+ _, mp, err = _get_mp()
289
+ if err:
290
+ return err
291
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
292
+ if not clip:
293
+ return {"error": f"Clip {clip_id} not found"}
294
+ media_id = clip.GetMediaId()
295
+ return {"clip_id": clip_id, "media_id": media_id}
296
+
297
+
298
+ @mcp.tool()
299
+ def add_clip_marker(clip_id: str, frame_id: int, color: str, name: str, note: str = "", duration: int = 1, custom_data: str = "") -> Dict[str, Any]:
300
+ """Add a marker to a Media Pool clip.
301
+
302
+ Args:
303
+ clip_id: Unique ID of the clip.
304
+ frame_id: Frame number for the marker.
305
+ color: Marker color (Blue, Cyan, Green, Yellow, Red, Pink, Purple, Fuchsia, Rose, Lavender, Sky, Mint, Lemon, Sand, Cocoa, Cream).
306
+ name: Marker name.
307
+ note: Marker note. Default: empty.
308
+ duration: Marker duration in frames. Default: 1.
309
+ custom_data: Custom data string. Default: empty.
310
+ """
311
+ _, mp, err = _get_mp()
312
+ if err:
313
+ return err
314
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
315
+ if not clip:
316
+ return {"error": f"Clip {clip_id} not found"}
317
+ result = clip.AddMarker(frame_id, color, name, note, duration, custom_data)
318
+ return {"success": bool(result)}
319
+
320
+
321
+ @mcp.tool()
322
+ def get_clip_markers(clip_id: str) -> Dict[str, Any]:
323
+ """Get all markers on a Media Pool clip.
324
+
325
+ Args:
326
+ clip_id: Unique ID of the clip.
327
+ """
328
+ _, mp, err = _get_mp()
329
+ if err:
330
+ return err
331
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
332
+ if not clip:
333
+ return {"error": f"Clip {clip_id} not found"}
334
+ markers = clip.GetMarkers()
335
+ return {"clip_id": clip_id, "markers": markers if markers else {}}
336
+
337
+
338
+ @mcp.tool()
339
+ def get_clip_marker_by_custom_data(clip_id: str, custom_data: str) -> Dict[str, Any]:
340
+ """Get a marker by its custom data string.
341
+
342
+ Args:
343
+ clip_id: Unique ID of the clip.
344
+ custom_data: Custom data string to search for.
345
+ """
346
+ _, mp, err = _get_mp()
347
+ if err:
348
+ return err
349
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
350
+ if not clip:
351
+ return {"error": f"Clip {clip_id} not found"}
352
+ marker = clip.GetMarkerByCustomData(custom_data)
353
+ return {"marker": marker if marker else {}}
354
+
355
+
356
+ @mcp.tool()
357
+ def update_clip_marker_custom_data(clip_id: str, frame_id: int, custom_data: str) -> Dict[str, Any]:
358
+ """Update the custom data of a clip marker.
359
+
360
+ Args:
361
+ clip_id: Unique ID of the clip.
362
+ frame_id: Frame number of the marker.
363
+ custom_data: New custom data string.
364
+ """
365
+ _, mp, err = _get_mp()
366
+ if err:
367
+ return err
368
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
369
+ if not clip:
370
+ return {"error": f"Clip {clip_id} not found"}
371
+ result = clip.UpdateMarkerCustomData(frame_id, custom_data)
372
+ return {"success": bool(result)}
373
+
374
+
375
+ @mcp.tool()
376
+ def get_clip_marker_custom_data(clip_id: str, frame_id: int) -> Dict[str, Any]:
377
+ """Get the custom data of a clip marker at a specific frame.
378
+
379
+ Args:
380
+ clip_id: Unique ID of the clip.
381
+ frame_id: Frame number of the marker.
382
+ """
383
+ _, mp, err = _get_mp()
384
+ if err:
385
+ return err
386
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
387
+ if not clip:
388
+ return {"error": f"Clip {clip_id} not found"}
389
+ data = clip.GetMarkerCustomData(frame_id)
390
+ return {"frame_id": frame_id, "custom_data": data if data else ""}
391
+
392
+
393
+ @mcp.tool()
394
+ def delete_clip_markers_by_color(clip_id: str, color: str) -> Dict[str, Any]:
395
+ """Delete all markers of a specific color on a clip.
396
+
397
+ Args:
398
+ clip_id: Unique ID of the clip.
399
+ color: Color of markers to delete. Use '' to delete all.
400
+ """
401
+ _, mp, err = _get_mp()
402
+ if err:
403
+ return err
404
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
405
+ if not clip:
406
+ return {"error": f"Clip {clip_id} not found"}
407
+ result = clip.DeleteMarkersByColor(color)
408
+ return {"success": bool(result)}
409
+
410
+
411
+ @mcp.tool()
412
+ def delete_clip_marker_at_frame(clip_id: str, frame_id: int) -> Dict[str, Any]:
413
+ """Delete a marker at a specific frame on a clip.
414
+
415
+ Args:
416
+ clip_id: Unique ID of the clip.
417
+ frame_id: Frame number of the marker to delete.
418
+ """
419
+ _, mp, err = _get_mp()
420
+ if err:
421
+ return err
422
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
423
+ if not clip:
424
+ return {"error": f"Clip {clip_id} not found"}
425
+ result = clip.DeleteMarkerAtFrame(frame_id)
426
+ return {"success": bool(result)}
427
+
428
+
429
+ @mcp.tool()
430
+ def delete_clip_marker_by_custom_data(clip_id: str, custom_data: str) -> Dict[str, Any]:
431
+ """Delete a marker by its custom data string.
432
+
433
+ Args:
434
+ clip_id: Unique ID of the clip.
435
+ custom_data: Custom data string of the marker to delete.
436
+ """
437
+ _, mp, err = _get_mp()
438
+ if err:
439
+ return err
440
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
441
+ if not clip:
442
+ return {"error": f"Clip {clip_id} not found"}
443
+ result = clip.DeleteMarkerByCustomData(custom_data)
444
+ return {"success": bool(result)}
445
+
446
+
447
+ @mcp.tool()
448
+ def add_clip_flag(clip_id: str, color: str) -> Dict[str, Any]:
449
+ """Add a flag to a Media Pool clip.
450
+
451
+ Args:
452
+ clip_id: Unique ID of the clip.
453
+ color: Flag color (Blue, Cyan, Green, Yellow, Red, Pink, Purple, Fuchsia, Rose, Lavender, Sky, Mint, Lemon, Sand, Cocoa, Cream).
454
+ """
455
+ _, mp, err = _get_mp()
456
+ if err:
457
+ return err
458
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
459
+ if not clip:
460
+ return {"error": f"Clip {clip_id} not found"}
461
+ result = clip.AddFlag(color)
462
+ return {"success": bool(result)}
463
+
464
+
465
+ @mcp.tool()
466
+ def get_clip_flag_list(clip_id: str) -> Dict[str, Any]:
467
+ """Get list of flags on a clip.
468
+
469
+ Args:
470
+ clip_id: Unique ID of the clip.
471
+ """
472
+ _, mp, err = _get_mp()
473
+ if err:
474
+ return err
475
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
476
+ if not clip:
477
+ return {"error": f"Clip {clip_id} not found"}
478
+ flags = clip.GetFlagList()
479
+ return {"clip_id": clip_id, "flags": flags if flags else []}
480
+
481
+
482
+ @mcp.tool()
483
+ def clear_clip_flags(clip_id: str, color: str = "") -> Dict[str, Any]:
484
+ """Clear flags on a clip.
485
+
486
+ Args:
487
+ clip_id: Unique ID of the clip.
488
+ color: Specific color to clear, or empty for all colors.
489
+ """
490
+ _, mp, err = _get_mp()
491
+ if err:
492
+ return err
493
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
494
+ if not clip:
495
+ return {"error": f"Clip {clip_id} not found"}
496
+ result = clip.ClearFlags(color)
497
+ return {"success": bool(result)}
498
+
499
+
500
+ @mcp.tool()
501
+ def get_clip_color(clip_id: str) -> Dict[str, Any]:
502
+ """Get the clip color of a Media Pool item.
503
+
504
+ Args:
505
+ clip_id: Unique ID of the clip.
506
+ """
507
+ _, mp, err = _get_mp()
508
+ if err:
509
+ return err
510
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
511
+ if not clip:
512
+ return {"error": f"Clip {clip_id} not found"}
513
+ color = clip.GetClipColor()
514
+ return {"clip_id": clip_id, "clip_color": color if color else ""}
515
+
516
+
517
+ @mcp.tool()
518
+ def set_clip_color(clip_id: str, color: str) -> Dict[str, Any]:
519
+ """Set the clip color of a Media Pool item.
520
+
521
+ Args:
522
+ clip_id: Unique ID of the clip.
523
+ color: Color name (Orange, Apricot, Yellow, Lime, Olive, Green, Teal, Navy, Blue, Purple, Violet, Pink, Tan, Beige, Brown, Chocolate).
524
+ """
525
+ _, mp, err = _get_mp()
526
+ if err:
527
+ return err
528
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
529
+ if not clip:
530
+ return {"error": f"Clip {clip_id} not found"}
531
+ result = clip.SetClipColor(color)
532
+ return {"success": bool(result)}
533
+
534
+
535
+ @mcp.tool()
536
+ def clear_clip_color(clip_id: str) -> Dict[str, Any]:
537
+ """Clear the clip color of a Media Pool item.
538
+
539
+ Args:
540
+ clip_id: Unique ID of the clip.
541
+ """
542
+ _, mp, err = _get_mp()
543
+ if err:
544
+ return err
545
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
546
+ if not clip:
547
+ return {"error": f"Clip {clip_id} not found"}
548
+ result = clip.ClearClipColor()
549
+ return {"success": bool(result)}
550
+
551
+
552
+ @mcp.tool()
553
+ def set_clip_property(clip_id: str, property_name: str, property_value: str) -> Dict[str, Any]:
554
+ """Set a property on a Media Pool clip.
555
+
556
+ Args:
557
+ clip_id: Unique ID of the clip.
558
+ property_name: Property name (e.g. 'Clip Name', 'Comments', 'Description').
559
+ property_value: Value to set.
560
+ """
561
+ _, mp, err = _get_mp()
562
+ if err:
563
+ return err
564
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
565
+ if not clip:
566
+ return {"error": f"Clip {clip_id} not found"}
567
+ result = clip.SetClipProperty(property_name, property_value)
568
+ return {"success": bool(result)}
569
+
570
+
571
+ @mcp.tool()
572
+ def get_clip_property(clip_id: str, property_name: str = "") -> Dict[str, Any]:
573
+ """Get a property of a Media Pool clip.
574
+
575
+ Args:
576
+ clip_id: Unique ID of the clip.
577
+ property_name: Property name, or empty for all properties.
578
+ """
579
+ _, mp, err = _get_mp()
580
+ if err:
581
+ return err
582
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
583
+ if not clip:
584
+ return {"error": f"Clip {clip_id} not found"}
585
+ if property_name:
586
+ result = clip.GetClipProperty(property_name)
587
+ else:
588
+ result = clip.GetClipProperty()
589
+ return {"clip_id": clip_id, "property": result if result else {}}
590
+
591
+
592
+ @mcp.tool()
593
+ def set_media_pool_clip_name(clip_id: str, new_name: str) -> Dict[str, Any]:
594
+ """Rename a Media Pool clip.
595
+
596
+ Args:
597
+ clip_id: Unique ID of the clip.
598
+ new_name: New clip name.
599
+ """
600
+ _, mp, err = _get_mp()
601
+ if err:
602
+ return err
603
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
604
+ if not clip:
605
+ return {"error": f"Clip {clip_id} not found"}
606
+ missing = _requires_method(clip, "SetName", "20.2")
607
+ if missing:
608
+ return missing
609
+ result = clip.SetName(new_name)
610
+ return {"success": bool(result), "name": new_name}
611
+
612
+
613
+ @mcp.tool()
614
+ def link_clip_proxy_media(clip_id: str, proxy_path: str) -> Dict[str, Any]:
615
+ """Link proxy media to a clip.
616
+
617
+ Args:
618
+ clip_id: Unique ID of the clip.
619
+ proxy_path: Absolute path to the proxy media file.
620
+ """
621
+ _, mp, err = _get_mp()
622
+ if err:
623
+ return err
624
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
625
+ if not clip:
626
+ return {"error": f"Clip {clip_id} not found"}
627
+ result = clip.LinkProxyMedia(proxy_path)
628
+ return {"success": bool(result)}
629
+
630
+
631
+ @mcp.tool()
632
+ def link_clip_full_resolution_media(clip_id: str, full_res_media_path: str) -> Dict[str, Any]:
633
+ """Link full resolution media to a proxy clip.
634
+
635
+ Args:
636
+ clip_id: Unique ID of the clip.
637
+ full_res_media_path: Absolute path to the full resolution media file.
638
+ """
639
+ _, mp, err = _get_mp()
640
+ if err:
641
+ return err
642
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
643
+ if not clip:
644
+ return {"error": f"Clip {clip_id} not found"}
645
+ missing = _requires_method(clip, "LinkFullResolutionMedia", "20.0")
646
+ if missing:
647
+ return missing
648
+ result = clip.LinkFullResolutionMedia(full_res_media_path)
649
+ return {"success": bool(result)}
650
+
651
+
652
+ @mcp.tool()
653
+ def unlink_clip_proxy_media(clip_id: str) -> Dict[str, Any]:
654
+ """Unlink proxy media from a clip.
655
+
656
+ Args:
657
+ clip_id: Unique ID of the clip.
658
+ """
659
+ _, mp, err = _get_mp()
660
+ if err:
661
+ return err
662
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
663
+ if not clip:
664
+ return {"error": f"Clip {clip_id} not found"}
665
+ result = clip.UnlinkProxyMedia()
666
+ return {"success": bool(result)}
667
+
668
+
669
+ @mcp.tool()
670
+ def replace_media_pool_clip(clip_id: str, new_file_path: str) -> Dict[str, Any]:
671
+ """Replace a clip with a new media file.
672
+
673
+ Args:
674
+ clip_id: Unique ID of the clip to replace.
675
+ new_file_path: Absolute path to the new media file.
676
+ """
677
+ _, mp, err = _get_mp()
678
+ if err:
679
+ return err
680
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
681
+ if not clip:
682
+ return {"error": f"Clip {clip_id} not found"}
683
+ result = clip.ReplaceClip(new_file_path)
684
+ return {"success": bool(result)}
685
+
686
+
687
+ @mcp.tool()
688
+ def replace_media_pool_clip_preserve_sub_clip(clip_id: str, file_path: str) -> Dict[str, Any]:
689
+ """Replace a clip's underlying media while preserving subclip extents.
690
+
691
+ Args:
692
+ clip_id: Unique ID of the clip to replace.
693
+ file_path: Absolute path to the replacement media file.
694
+ """
695
+ _, mp, err = _get_mp()
696
+ if err:
697
+ return err
698
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
699
+ if not clip:
700
+ return {"error": f"Clip {clip_id} not found"}
701
+ missing = _requires_method(clip, "ReplaceClipPreserveSubClip", "20.0")
702
+ if missing:
703
+ return missing
704
+ result = clip.ReplaceClipPreserveSubClip(file_path)
705
+ return {"success": bool(result)}
706
+
707
+
708
+ @mcp.tool()
709
+ def monitor_clip_growing_file(clip_id: str) -> Dict[str, Any]:
710
+ """Monitor a growing media file for the given Media Pool clip."""
711
+ _, mp, err = _get_mp()
712
+ if err:
713
+ return err
714
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
715
+ if not clip:
716
+ return {"error": f"Clip {clip_id} not found"}
717
+ missing = _requires_method(clip, "MonitorGrowingFile", "20.0")
718
+ if missing:
719
+ return missing
720
+ result = clip.MonitorGrowingFile()
721
+ return {"success": bool(result)}
722
+
723
+
724
+ @mcp.tool()
725
+ def get_clip_unique_id_by_name(clip_name: str) -> Dict[str, Any]:
726
+ """Find a clip by name and return its unique ID.
727
+
728
+ Args:
729
+ clip_name: Name of the clip to find.
730
+ """
731
+ _, mp, err = _get_mp()
732
+ if err:
733
+ return err
734
+
735
+ def search(folder):
736
+ for clip in (folder.GetClipList() or []):
737
+ if clip.GetName() == clip_name:
738
+ return clip
739
+ for sub in (folder.GetSubFolderList() or []):
740
+ found = search(sub)
741
+ if found:
742
+ return found
743
+ return None
744
+
745
+ clip = search(mp.GetRootFolder())
746
+ if clip:
747
+ return {"name": clip.GetName(), "unique_id": clip.GetUniqueId()}
748
+ return {"error": f"Clip '{clip_name}' not found"}
749
+
750
+
751
+ @mcp.tool()
752
+ def transcribe_clip_audio(clip_id: str) -> Dict[str, Any]:
753
+ """Transcribe audio for a specific clip.
754
+
755
+ Args:
756
+ clip_id: Unique ID of the clip.
757
+ """
758
+ _, mp, err = _get_mp()
759
+ if err:
760
+ return err
761
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
762
+ if not clip:
763
+ return {"error": f"Clip {clip_id} not found"}
764
+ result = clip.TranscribeAudio()
765
+ return {"success": bool(result)}
766
+
767
+
768
+ @mcp.tool()
769
+ def clear_clip_transcription(clip_id: str) -> Dict[str, Any]:
770
+ """Clear transcription for a specific clip.
771
+
772
+ Args:
773
+ clip_id: Unique ID of the clip.
774
+ """
775
+ _, mp, err = _get_mp()
776
+ if err:
777
+ return err
778
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
779
+ if not clip:
780
+ return {"error": f"Clip {clip_id} not found"}
781
+ result = clip.ClearTranscription()
782
+ return {"success": bool(result)}
783
+
784
+
785
+ @mcp.tool()
786
+ def get_clip_audio_mapping(clip_id: str) -> Dict[str, Any]:
787
+ """Get audio mapping for a clip.
788
+
789
+ Args:
790
+ clip_id: Unique ID of the clip.
791
+ """
792
+ _, mp, err = _get_mp()
793
+ if err:
794
+ return err
795
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
796
+ if not clip:
797
+ return {"error": f"Clip {clip_id} not found"}
798
+ mapping = clip.GetAudioMapping()
799
+ return {"clip_id": clip_id, "audio_mapping": mapping if mapping else ""}
800
+
801
+
802
+ @mcp.tool()
803
+ def get_clip_mark_in_out(clip_id: str) -> Dict[str, Any]:
804
+ """Get mark in/out points for a clip.
805
+
806
+ Args:
807
+ clip_id: Unique ID of the clip.
808
+ """
809
+ _, mp, err = _get_mp()
810
+ if err:
811
+ return err
812
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
813
+ if not clip:
814
+ return {"error": f"Clip {clip_id} not found"}
815
+ result = clip.GetMarkInOut()
816
+ return {"clip_id": clip_id, "mark_in_out": result if result else {}}
817
+
818
+
819
+ @mcp.tool()
820
+ def set_clip_mark_in_out(clip_id: str, mark_in: int, mark_out: int) -> Dict[str, Any]:
821
+ """Set mark in/out points for a clip.
822
+
823
+ Args:
824
+ clip_id: Unique ID of the clip.
825
+ mark_in: Mark in frame number.
826
+ mark_out: Mark out frame number.
827
+ """
828
+ _, mp, err = _get_mp()
829
+ if err:
830
+ return err
831
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
832
+ if not clip:
833
+ return {"error": f"Clip {clip_id} not found"}
834
+ result = clip.SetMarkInOut(mark_in, mark_out)
835
+ return {"success": bool(result)}
836
+
837
+
838
+ @mcp.tool()
839
+ def clear_clip_mark_in_out(clip_id: str) -> Dict[str, Any]:
840
+ """Clear mark in/out points for a clip.
841
+
842
+ Args:
843
+ clip_id: Unique ID of the clip.
844
+ """
845
+ _, mp, err = _get_mp()
846
+ if err:
847
+ return err
848
+ clip = _find_clip_by_id(mp.GetRootFolder(), clip_id)
849
+ if not clip:
850
+ return {"error": f"Clip {clip_id} not found"}
851
+ result = clip.ClearMarkInOut()
852
+ return {"success": bool(result)}