load_instrument_or_effect_tool
Load instruments or effects onto Ableton Live tracks by specifying the track index and URI. Integrates with the AbletonMCP server for AI-assisted music production.
Instructions
Load an instrument or effect onto a track using its URI.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track_index | Yes | ||
| uri | Yes |
Implementation Reference
- MCP_Server/server.py:140-144 (handler)MCP tool handler decorated with @mcp.tool(). Delegates to the load_instrument_or_effect helper function.@mcp.tool() def load_instrument_or_effect_tool(ctx: Context, track_index: int, uri: str) -> str: """Load an instrument or effect onto a track using its URI.""" return load_instrument_or_effect(ctx, track_index, uri)
- Core logic for loading instrument or effect. Connects to Ableton and sends 'load_browser_item' command with track_index and uri, then formats response.def load_instrument_or_effect(ctx: Context, track_index: int, uri: str) -> str: """ Load an instrument or effect onto a track using its URI. Parameters: - track_index: The index of the track to load the instrument on - uri: The URI of the instrument or effect to load (e.g., 'query:Synths#Instrument%20Rack:Bass:FileId_5116') """ try: ableton = get_ableton_connection() result = ableton.send_command("load_browser_item", {"track_index": track_index, "item_uri": uri}) # Check if the instrument was loaded successfully if result.get("loaded", False): new_devices = result.get("new_devices", []) if new_devices: return ( f"Loaded instrument with URI '{uri}' on track {track_index}. New devices: {', '.join(new_devices)}" ) else: devices = result.get("devices_after", []) return ( f"Loaded instrument with URI '{uri}' on track {track_index}. Devices on track: {', '.join(devices)}" ) else: return f"Failed to load instrument with URI '{uri}'" except Exception as e: logger.error(f"Error loading instrument by URI: {str(e)}") return f"Error loading instrument by URI: {str(e)}"
- MCP_Server/server.py:140-140 (registration)The @mcp.tool() decorator registers the function as an MCP tool.@mcp.tool()