create_midi_track
Add a new MIDI track to an Ableton Live session at a specified index position using the AbletonMCP server. Simplify MIDI track creation for AI-assisted music production workflows.
Instructions
Create a new MIDI track in the Ableton session.
Parameters:
index: The index to insert the track at (-1 = end of list)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | No |
Implementation Reference
- MCP_Server/server.py:288-302 (handler)MCP tool handler function decorated with @mcp.tool(). It connects to the Ableton remote script and sends the 'create_midi_track' command with the index parameter, returning the result.@mcp.tool() def create_midi_track(ctx: Context, index: int = -1) -> str: """ Create a new MIDI track in the Ableton session. Parameters: - index: The index to insert the track at (-1 = end of list) """ try: ableton = get_ableton_connection() result = ableton.send_command("create_midi_track", {"index": index}) return f"Created new MIDI track: {result.get('name', 'unknown')}" except Exception as e: logger.error(f"Error creating MIDI track: {str(e)}") return f"Error creating MIDI track: {str(e)}"
- The core implementation of the create_midi_track command in the Ableton remote script. Calls the Ableton Live API self._song.create_midi_track(index) to create the track and returns index and name.def _create_midi_track(self, index): """Create a new MIDI track at the specified index""" try: # Create the track self._song.create_midi_track(index) # Get the new track new_track_index = len(self._song.tracks) - 1 if index == -1 else index new_track = self._song.tracks[new_track_index] result = { "index": new_track_index, "name": new_track.name } return result except Exception as e: self.log_message("Error creating MIDI track: " + str(e)) raise
- Dispatch logic in _process_command that routes the 'create_midi_track' socket command to the _create_midi_track handler method.if command_type == "create_midi_track": index = params.get("index", -1) result = self._create_midi_track(index)
- MCP_Server/server.py:104-108 (registration)List of modifying commands including 'create_midi_track' that triggers special handling (delays) in send_command method.is_modifying_command = command_type in [ "create_midi_track", "create_audio_track", "set_track_name", "create_clip", "add_notes_to_clip", "set_clip_name", "set_tempo", "fire_clip", "stop_clip", "set_device_parameter", "start_playback", "stop_playback", "load_instrument_or_effect"