Skip to main content
Glama

create_clip

Create a new MIDI clip in Ableton Live by specifying track and clip slot indices, with customizable length in beats for music production workflows.

Instructions

Create a new MIDI clip in the specified track and clip slot.

Parameters:

  • track_index: The index of the track to create the clip in

  • clip_index: The index of the clip slot to create the clip in

  • length: The length of the clip in beats (default: 4.0)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
track_indexYes
clip_indexYes
lengthNo

Implementation Reference

  • Primary MCP tool handler for 'create_clip'. Decorated with @mcp.tool() for automatic registration and schema inference from signature/docstring. Proxies parameters to the Ableton remote script via socket command.
    @mcp.tool()
    def create_clip(ctx: Context, track_index: int, clip_index: int, length: float = 4.0) -> str:
        """
        Create a new MIDI clip in the specified track and clip slot.
        
        Parameters:
        - track_index: The index of the track to create the clip in
        - clip_index: The index of the clip slot to create the clip in
        - length: The length of the clip in beats (default: 4.0)
        """
        try:
            ableton = get_ableton_connection()
            result = ableton.send_command("create_clip", {
                "track_index": track_index, 
                "clip_index": clip_index, 
                "length": length
            })
            return f"Created new clip at track {track_index}, slot {clip_index} with length {length} beats"
        except Exception as e:
            logger.error(f"Error creating clip: {str(e)}")
            return f"Error creating clip: {str(e)}"
  • Core implementation of clip creation using Ableton Live API: retrieves track and clip_slot then calls clip_slot.create_clip(length). Called by the remote script's command dispatcher.
    def _create_clip(self, track_index, clip_index, length):
        """Create a new MIDI clip in the specified track and clip slot"""
        try:
            if track_index < 0 or track_index >= len(self._song.tracks):
                raise IndexError("Track index out of range")
            
            track = self._song.tracks[track_index]
            
            if clip_index < 0 or clip_index >= len(track.clip_slots):
                raise IndexError("Clip index out of range")
            
            clip_slot = track.clip_slots[clip_index]
            
            # Check if the clip slot already has a clip
            if clip_slot.has_clip:
                raise Exception("Clip slot already has a clip")
            
            # Create the clip
            clip_slot.create_clip(length)
            
            result = {
                "name": clip_slot.clip.name,
                "length": clip_slot.clip.length
            }
            return result
        except Exception as e:
            self.log_message("Error creating clip: " + str(e))
            raise
  • Command registration/dispatch in the Ableton remote script's socket command processor (_process_command). Routes 'create_clip' to the _create_clip handler.
    elif command_type == "create_clip":
        track_index = params.get("track_index", 0)
        clip_index = params.get("clip_index", 0)
        length = params.get("length", 4.0)
        result = self._create_clip(track_index, clip_index, length)
  • Tool schema defined by function parameters and docstring, used by FastMCP for input validation and tool description.
    """
    Create a new MIDI clip in the specified track and clip slot.
    
    Parameters:
    - track_index: The index of the track to create the clip in
    - clip_index: The index of the clip slot to create the clip in
    - length: The length of the clip in beats (default: 4.0)
    """
  • List classifying 'create_clip' as a state-modifying command, which receives special handling (delays, timeouts) in the socket 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"
    ]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action ('Create a new MIDI clip') but doesn't disclose behavioral traits like whether this overwrites existing clips in the slot, requires specific permissions, or has side effects. The default length is mentioned, but other critical behaviors (e.g., error handling, clip initialization state) are omitted.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by a bulleted list of parameters with clear explanations. Every sentence earns its place without redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is moderately complete but has gaps. It covers the basic purpose and parameters but lacks behavioral details (e.g., what happens on failure, clip properties after creation) and output information. For a mutation tool with 3 parameters, this is adequate but not fully comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaningful semantics by explaining each parameter's purpose (e.g., 'track_index: The index of the track to create the clip in') and includes a default value for 'length'. However, it doesn't clarify parameter constraints (e.g., valid index ranges) or units beyond 'beats' for length.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Create a new MIDI clip') and specifies the target resources ('in the specified track and clip slot'). It distinguishes from siblings like 'add_notes_to_clip' (modifies existing clips) and 'create_midi_track' (creates tracks rather than clips), providing clear differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through parameter details (track_index, clip_index) but doesn't explicitly state when to use this tool versus alternatives like 'add_notes_to_clip' or 'set_clip_name'. No guidance on prerequisites (e.g., track must exist) or exclusions is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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