create_midi_track
Add a MIDI track to your Ableton Live session at a specified position to organize and expand your music project.
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 for create_midi_track. Gets Ableton connection and sends the internal create_midi_track command to the remote script with the index parameter.@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)}"
- MCP_Server/server.py:289-295 (schema)Input schema from function signature and docstring: index (int, default -1). Returns str describing the result.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) """
- MCP_Server/server.py:288-288 (registration)Registration of the tool using FastMCP @mcp.tool() decorator.@mcp.tool()
- Helper function in Ableton remote script implementing the actual track creation using Ableton Live API: self._song.create_midi_track(index)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