Skip to main content
Glama

set_track_name

Rename tracks in Ableton Live sessions by specifying track index and new name to organize music production projects.

Instructions

Set the name of a track.

Parameters:

  • track_index: The index of the track to rename

  • name: The new name for the track

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
track_indexYes
nameYes

Implementation Reference

  • MCP tool handler for 'set_track_name'. Forwards the command to the Ableton remote script via socket, handles connection and errors.
    @mcp.tool()
    def set_track_name(ctx: Context, track_index: int, name: str) -> str:
        """
        Set the name of a track.
        
        Parameters:
        - track_index: The index of the track to rename
        - name: The new name for the track
        """
        try:
            ableton = get_ableton_connection()
            result = ableton.send_command("set_track_name", {"track_index": track_index, "name": name})
            return f"Renamed track to: {result.get('name', name)}"
        except Exception as e:
            logger.error(f"Error setting track name: {str(e)}")
            return f"Error setting track name: {str(e)}"
  • Core implementation in Ableton remote script that directly sets track.name using Ableton Live API and returns confirmation.
    def _set_track_name(self, track_index, name):
        """Set the name of a track"""
        try:
            if track_index < 0 or track_index >= len(self._song.tracks):
                raise IndexError("Track index out of range")
            
            # Set the name
            track = self._song.tracks[track_index]
            track.name = name
            
            result = {
                "name": track.name
            }
            return result
        except Exception as e:
            self.log_message("Error setting track name: " + str(e))
            raise
  • Dispatch/registration point in remote script's _process_command where 'set_track_name' internal command is handled and routed to _set_track_name.
    elif command_type in ["create_midi_track", "set_track_name", 
                         "create_clip", "add_notes_to_clip", "set_clip_name", 
                         "set_tempo", "fire_clip", "stop_clip",
                         "start_playback", "stop_playback", "load_browser_item"]:
        # Use a thread-safe approach with a response queue
  • Specific dispatch handler within the main thread task for the 'set_track_name' command in remote script.
    elif command_type == "set_track_name":
        track_index = params.get("track_index", 0)
        name = params.get("name", "")
        result = self._set_track_name(track_index, name)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ahujasid/ableton-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server