Skip to main content
Glama

record_by_time_range

Automate audio recording in Ableton Live by specifying start and end times. Ensure the track is in record mode with correct input routing before initiating playback from the defined time range.

Instructions

Opens Ableton's audio record button and starts playback from start_time to end_time. Before recording, please: ENSURE: 1. Set the recording track to record mode 2. Set the recording track's input routing to Resample or a specific audio track/input routing 3. After recording, disable the track's record mode

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_timeYes[int] end time of record
start_timeYes[float] the time in beats of absolute clip time. such as 4 is 4 beats

Implementation Reference

  • Core handler function that implements the recording logic for the specified time range. It configures the song's start time and record mode, sets up a listener to monitor current song time, and stops recording and playback upon reaching the end time.
    export async function recordByTimeRange(song: Song, start_time: number, end_time: number) {
        await song.set('start_time' as any, start_time)
        await song.set('record_mode', 1)
        return new Promise<string>((resolve, reject) => {
            let removeFunc: (() => Promise<boolean | undefined>) | undefined
            song.addListener('current_song_time', async (time) => {
                try {
                    if (time >= end_time) {
                        // remove this listener
                        if (removeFunc) {
                            const release = await mutex.acquire()
                            try {
                                if (removeListenerFuncs.includes(removeFunc)) {
                                    await removeFunc()
                                    // remove from array
                                    removeListenerFuncs.splice(removeListenerFuncs.indexOf(removeFunc), 1)
                                    logger.info('remove listener in record_by_time_range')
                                }
                            } finally {
                                release()
                            }
                        }
                        await song.set('record_mode', 0)
                        await song.stopPlaying()
                        resolve(Result.ok())
                    }
                } catch (err) {
                    if (removeFunc) {
                        const release = await mutex.acquire()
                        try {
                            if (removeListenerFuncs.includes(removeFunc)) {
                                await removeFunc()
                                // remove from array
                                removeListenerFuncs.splice(removeListenerFuncs.indexOf(removeFunc), 1)
                                logger.info('remove listener in record_by_time_range')
                            }
                        } finally {
                            release()
                        }
                    }
                    reject(`record_by_time_range failed: ${err}`)
                }
            }).then(async listenerRemoveFunc => {
                removeFunc = listenerRemoveFunc
                const release = await mutex.acquire()
                try {
                    removeListenerFuncs.push(listenerRemoveFunc)
                } finally {
                    release()
                }
            }).catch(err => {
                logger.error(err)
                resolve('record_by_time_range failed')
            })
        })
    }
  • Zod schema defining the input parameters for the tool: start_time and end_time.
        paramsSchema: {
            start_time: commomProp.time,
            end_time: z.number().describe('[int] end time of record'),
        }
    })
  • Registers the 'record_by_time_range' tool using the @tool decorator, includes description and schema, and defines the handler method that delegates to the core recordByTimeRange function.
    @tool({
        name: 'record_by_time_range',
        description: `Opens Ableton's audio record button and starts playback from start_time to end_time. 
            Before recording, please:
            ENSURE: 
            1. Set the recording track to record mode
            2. Set the recording track's input routing to Resample or a specific audio track/input routing(get from get_track_available_input_routings tool)
            3. After recording, disable the track's record mode`,
        paramsSchema: {
            start_time: commomProp.time,
            end_time: z.number().describe('[int] end time of record'),
        }
    })
    async recordAudio({
        start_time, end_time
    }: {
        start_time: number,
        end_time: number,
    }) {
        return recordByTimeRange(ableton.song, start_time, end_time)
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: it initiates recording and playback within a time range, and includes pre- and post-recording steps (setting record mode, input routing, and disabling record mode). This adds valuable context beyond basic parameters, though it lacks details on error handling or output format.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core action and following with a structured 'ENSURE' list. Every sentence earns its place by providing essential setup steps, though it could be slightly more concise by integrating the list into a smoother narrative without sacrificing clarity.

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. It covers the tool's purpose, prerequisites, and basic behavior, but lacks details on what happens after recording (e.g., output format, success indicators) and does not address potential errors or constraints like rate limits. For a tool with 2 parameters and no structured safety hints, it should do more to compensate.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents both parameters with descriptions. The description adds minimal semantics by mentioning 'start_time to end_time' in context, but does not provide additional meaning beyond what the schema states, such as unit clarifications or usage examples. Baseline 3 is appropriate as the schema handles most of the parameter documentation.

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: 'Opens Ableton's audio record button and starts playback from start_time to end_time.' It distinguishes from siblings by focusing on recording with time constraints, unlike tools like 'create_track' or 'get_all_tracks' which are about track management. The verb 'Opens' and resource 'audio record button' are precise.

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

Usage Guidelines4/5

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

The description provides explicit prerequisites in the 'ENSURE' list, detailing when to use this tool by outlining necessary setup steps before recording. However, it does not specify when not to use it or name alternatives among siblings, such as 'create_empty_midi_clip' for non-audio tasks, leaving some contextual gaps.

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

Related 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/xiaolaa2/ableton-copilot-mcp'

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