Skip to main content
Glama

create_clip_tool

Generate a new MIDI clip in Ableton Live by specifying the track and clip slot for AI-assisted music production using the AbletonMCP server.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clip_indexYes
lengthNo
track_indexYes

Implementation Reference

  • The main handler function for the 'create_clip_tool' MCP tool, registered via @mcp.tool() decorator. Delegates execution to the create_clip helper function.
    @mcp.tool() def create_clip_tool(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.""" return create_clip(ctx, track_index, clip_index, length)
  • Helper function that sends the 'create_clip' command to the Ableton remote script connection, handling errors and returning status messages.
    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)}"
  • Remote script handler implementing the clip creation using Ableton Live Python API: clip_slot.create_clip(length). Called via the MCP server connection.
    def create_clip(self, track_index: int, clip_index: int, length: float) -> dict[str, Any]: """Create a new MIDI clip in the specified track and clip slot""" try: clip_slot = self.get_clip_slot(track_index, 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

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/chaudepark/ableton-mcp'

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