Add arrangement duplication, browser search, device control, and batch commands - #97
Add arrangement duplication, browser search, device control, and batch commands#97vanjaoljaca wants to merge 12 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds many new remote commands and MCP tools: browser search/load, device parameter inspection/control (by index/name), execute_batch, session track/scene/clip creation, duplication into arrangement, stop/back-to-arrangement flows with verification, and an export_audio placeholder; routes many mutating commands through main-thread scheduling and verification helpers. ChangesAbleton Remote Control Expansion
Sequence Diagram(s)sequenceDiagram
participant Client
participant MCP_Server
participant AbletonMCP
participant Live
Client->>MCP_Server: MCP tool request (e.g., set_device_parameter, search_browser_items)
MCP_Server->>AbletonMCP: send_command / forward remote command
AbletonMCP->>AbletonMCP: enqueue main-thread task (response_queue)
AbletonMCP->>Live: main_thread_task executes command (device/set/duplicate/load)
Live-->>AbletonMCP: state changes / device/clip snapshots
AbletonMCP->>AbletonMCP: verify (deferred) and build response
AbletonMCP-->>MCP_Server: JSON result or error
MCP_Server-->>Client: formatted response
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
f7c3874 to
8b264f6
Compare
Review Summary by QodoAdd arrangement duplication, browser search, device parameters, and batch commands
WalkthroughsDescription• Add Session-to-Arrangement duplication with clip/scene copying and verification • Add browser search, device introspection, and parameter setting by index/name • Add simple batch command execution API for bundling multiple commands • Add audio export command surface (hard-fail as unimplemented) • Add scene creation, audio track creation, and improved clip creation with auto-scene • Implement deferred response verification for state-dependent operations Diagramflowchart LR
Session["Session Clips/Scenes"]
Arrangement["Arrangement Timeline"]
Browser["Browser Search"]
Device["Device Parameters"]
Batch["Batch Executor"]
Session -->|duplicate_clip_to_arrangement| Arrangement
Session -->|duplicate_scene_to_arrangement| Arrangement
Browser -->|search_browser_items| Results["Search Results"]
Results -->|load_browser_item_by_uri| Device
Device -->|set_device_parameter| Verify["Readback Verification"]
Batch -->|execute_batch| MultiCmd["Multiple Commands"]
File Changes1. AbletonMCP_Remote_Script/__init__.py
|
Code Review by Qodo
1.
|
|
Ready for review now; I moved this out of draft so the review automation can run. @coderabbitai review Validation is already detailed in the PR body. Headline checks: tested against Ableton Live through the localhost Remote Script socket, verified duplicate clip/scene to Arrangement via arrangement clip count changes, verified browser search/load and device parameter readbacks, and |
|
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
AbletonMCP_Remote_Script/__init__.py (1)
1545-1548: 💤 Low valueNote: Batch browser load uses synchronous verification.
In
_execute_batch_command,load_browser_itemcalls_verify_load_browser_itemimmediately after_load_browser_item, whereas the standalone command path usesschedule_message(4, ...)for deferred verification. If Live's state update is not immediate, batch verification may reportloaded: falseeven when the load succeeds.This may be acceptable if browser.load_item is synchronous, but the behavior differs from the deferred pattern. Consider documenting this or aligning the verification approach.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@AbletonMCP_Remote_Script/__init__.py` around lines 1545 - 1548, The batch path in _execute_batch_command calls _load_browser_item and then immediately calls _verify_load_browser_item, which differs from the standalone command that defers verification via schedule_message(4, ...). Change the batch handling so verification is deferred the same way: after calling _load_browser_item (and obtaining the result or item identifiers), schedule a deferred call using schedule_message(4, ...) to run _verify_load_browser_item with the same arguments (or document the synchronous behavior if intentional); update references in _execute_batch_command so that _load_browser_item, _verify_load_browser_item and schedule_message are used consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AbletonMCP_Remote_Script/__init__.py`:
- Around line 1263-1271: The _safe_getattr function uses a bare except which can
swallow BaseException; update the exception handler to "except Exception:" to
only catch standard exceptions and preserve returning the provided default;
locate the _safe_getattr(obj, attr, default=None) method and replace the bare
"except:" with "except Exception:" (no other behavioral changes needed).
- Around line 1908-1913: The conversion of max_results uses a bare except which
can hide system exceptions; update the try/except around int(max_results) to
catch only the expected exceptions (ValueError and TypeError) when parsing
max_results, and leave the existing fallback behavior (set max_results = 20 and
then enforce max_results <= 0 => 20) intact; locate the conversion near the
variable max_results in __init__.py and replace the generic except with a
specific except for those exception types.
---
Nitpick comments:
In `@AbletonMCP_Remote_Script/__init__.py`:
- Around line 1545-1548: The batch path in _execute_batch_command calls
_load_browser_item and then immediately calls _verify_load_browser_item, which
differs from the standalone command that defers verification via
schedule_message(4, ...). Change the batch handling so verification is deferred
the same way: after calling _load_browser_item (and obtaining the result or item
identifiers), schedule a deferred call using schedule_message(4, ...) to run
_verify_load_browser_item with the same arguments (or document the synchronous
behavior if intentional); update references in _execute_batch_command so that
_load_browser_item, _verify_load_browser_item and schedule_message are used
consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 253f1380-c46b-401b-8708-56ade87c19ef
📒 Files selected for processing (2)
AbletonMCP_Remote_Script/__init__.pyMCP_Server/server.py
|
Addressed Qodo review feedback in
Validation after the fix: |
|
Follow-up for CodeRabbit cleanup in |
|
@vanjaoljaca how did you test the reliability of this? |
|
Daily heartbeat: this PR is still open and ready for review. Current status: mergeable |
1 similar comment
|
Daily heartbeat: this PR is still open and ready for review. Current status: mergeable |
|
Hi, I plugged it into my codex overnight and had it try replicate a song. It hacked away at ableton for hours and no crashes, though I did not verify that it tested all the available mcp commands |
…-to-arrangement # Conflicts: # AbletonMCP_Remote_Script/__init__.py # MCP_Server/server.py
Test resultsRetested this branch against real Ableton Live 12.3.7 with the branch Remote Script loaded and listening on Live Ableton smoke
Local checks
Note: the Ableton session used for smoke testing has unsaved test artifacts named |
|
Daily heartbeat: this PR is still open and ready for review. Current status: mergeable |
|
Daily heartbeat: this PR is still open and ready for review. Current status: mergeable |
3 similar comments
|
Daily heartbeat: this PR is still open and ready for review. Current status: mergeable |
|
Daily heartbeat: this PR is still open and ready for review. Current status: mergeable |
|
Daily heartbeat: this PR is still open and ready for review. Current status: mergeable |
46f3be4 to
babc39d
Compare
Summary
back_to_arrangementandstop_all_clipshelpers with readback verification.execute_batchAPI for bundling multiple known-index commands into one socket call.export_audiocommand surface, but hard-fail it as unimplemented rather than returning a soft unsupported success-shaped payload.Details
duplicate_clip_to_arrangement(track_index, scene_index, start_time)copies one Session clip to Arrangement usingtrack.duplicate_clip_to_arrangement.duplicate_scene_to_arrangement(scene_index, start_time, track_indices?)copies clips from a Session scene into Arrangement, skipping empty slots.stop_all_clipsandback_to_arrangementverify Live state on a later Remote Script tick, because Live does not update the relevant state synchronously inside the same callback.search_browser_items(query, category?, max_results?)searches Ableton browser names/paths and returns{name, path, uri, is_loadable, is_device}results.plugins,max_for_live,packs, anduser_libraryroots in addition to the built-in instrument/effect categories.load_browser_item_by_uri(track_index, uri)exposes URI loading through MCP, while the underlying Remote Scriptload_browser_itemnow returnsdevices_before,devices_after,new_devices, and device counts.get_device_info(track_index, device_index)andget_device_parameters(track_index, device_index)expose device metadata and automatable parameters.set_device_parameter(...)andset_device_parameter_by_name(...)set parameters and return before/after readback.execute_batch(commands, stop_on_error?)executes simple explicit-index command lists. It intentionally does not support result references yet.load_instrument_or_effect(track_index, uri)benefits from the same verified device readback.Validation
Tested against Ableton Live through the localhost Remote Script socket, checking actual Live state rather than only response success flags:
duplicate_clip_to_arrangement: test clip duplicated into Arrangement, arrangement clip count increased0 -> 1.duplicate_scene_to_arrangement: test scene/track duplicated into Arrangement, arrangement clip count increased1 -> 2.stop_all_clips: response showed a real playing Session clip inplaying_beforeandplaying_after: []after the command.back_to_arrangement: response showedback_to_arranger_before: true,back_to_arranger_after: false, and no Session clips still playing.search_browser_items: searchedDriftininstrumentsand found loadable URIquery:Synths#Drift.load_browser_item: loadedquery:Synths#Driftonto a fresh MIDI track; device count increased0 -> 1,new_devices: ["Drift"], andget_track_infoshowed the added Drift device.search_browser_itemsplusload_browser_item_by_uri: returned the same loadable Drift URI and verified device count0 -> 1on a fresh track.load_instrument_or_effect: loadedquery:Synths#Driftand reportedNew devices: Drift.get_device_infoandget_device_parameters: returned Drift metadata and exposed parameters includingLP Freq.set_device_parameter: changed DriftLP Freqfrom1.0to about0.33with readback.set_device_parameter_by_name: restored DriftLP Freqby parameter name with readback.execute_batch: explicit-index batch renamed a track, loaded Drift, read parameters, and setLP Freq; batch returned per-command success and verified load/parameter results.get_device_parameters,set_device_parameter,set_device_parameter_by_name,execute_batch, andcreate_audio_track.search_browser_items(..., category="plugins")is accepted, but that local Ableton install had no third-party plugins exposed.vanjaoljacaaccount using the same patched script on a separate test socket port (9878, local test setup only):search_browser_items("Kontakt", category="plugins"): 6 loadable results, including AUv2/VST3 Kontakt, Kontakt 7, and Kontakt 8 URIs.search_browser_items("Native", category="plugins"): 20 results, 18 loadable.search_browser_items("Massive", category="plugins"): 4 loadable results.search_browser_items("Guitar", category="plugins"): 4 loadable results.search_browser_items("Reaktor", category="plugins"): 4 loadable results.query:Plugins#AUv2:Native%20Instruments:Kontaktonto a fresh MIDI track; device count increased0 -> 1,new_devices: ["Kontakt"], andget_track_inforeportedclass_name: AuPluginDevice.get_device_parameterson Kontakt succeeded; Live exposed onlyDevice Onfor that plugin instance, so no safe non-quantized Kontakt parameter was available to set.set_device_parameter_by_name("LP Freq", 0.25)read backvalue_after: 0.25withsuccess: true.export_audio: returns socketstatus: errorwithexport_audio is not implemented by AbletonMCP.python3 -m py_compile AbletonMCP_Remote_Script/__init__.py MCP_Server/server.pySummary by CodeRabbit