Skip to main content
Glama
bschoepke

ableton-live-mcp

by bschoepke

live_eval

Evaluate Python expressions inside Ableton Live using song, app, obj, and Live bindings for dynamic control and data retrieval.

Instructions

Evaluate a Python expression inside Live with song, app, obj, and Live bindings. General Live object-model bridge; examples are heuristics, not limits. Use live_exec for statements; prefer installed browser/library assets before generated assets unless asked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exprYes
refNo
detailNo
max_itemsNo
max_depthNo
max_string_lengthNo
timeoutNoSeconds to wait for Live's main thread.

Implementation Reference

  • src/server.py:260-268 (registration)
    The tool 'live_eval' is registered as an MCP tool with schema requiring 'expr' (string), optional 'ref', and response controls. It uses forward('eval') which delegates to the bridge.
    server.add_tool(Tool("live_eval", (
        "Evaluate a Python expression inside Live with song, app, obj, and Live bindings. "
        + ABLETON_AGENT_GUIDE
        + " Use live_exec for statements; prefer installed browser/library assets before generated assets unless asked."
    ), schema({
        "expr": {"type": "string"},
        "ref": ref,
        **response_controls,
    }, ["expr"]), forward("eval")))
  • The handler for live_eval is a lambda created by forward('eval'), which calls bridge.request('eval', args). This sends a JSON-RPC request to the Ableton bridge.
    def forward(method: str):
        return lambda args: bridge.request(method, args)
  • Input schema for live_eval: requires 'expr' (string), optional 'ref' (object with path/id), plus optional response controls (detail, max_items, max_depth, max_string_length, timeout).
    ), schema({
        "expr": {"type": "string"},
        "ref": ref,
        **response_controls,
    }, ["expr"]), forward("eval")))
  • The bridge request method sends the 'eval' JSON-RPC method to the Ableton Live bridge over a socket connection and returns the result.
    def request(self, method: str, params: dict[str, Any] | None = None) -> Any:
        params = params or {}
        payload = {
            "jsonrpc": "2.0",
            "id": next(self._ids),
            "method": method,
            "params": params,
        }
        with self._lock:
            try:
                response = self._send(payload)
            except OSError:
                self.close()
                try:
                    response = self._send(payload)
                except OSError as exc:
                    self.close()
                    raise AbletonBridgeError(f"Could not connect to Ableton bridge at {self.config.host}:{self.config.port}: {exc}") from exc
        message = json.loads(response.decode("utf-8"))
        if "error" in message:
            err = message["error"]
            detail = err.get("data") if os.environ.get("ABLETON_MCP_TRACEBACK") else ""
            suffix = f": {detail}" if detail else ""
            raise AbletonBridgeError(f"{err.get('code', -32000)} {err.get('message', 'Bridge error')}{suffix}")
        return message.get("result")
    
    def close(self) -> None:
        if self._sock is not None:
            try:
                self._sock.close()
            except OSError:
                pass
            self._sock = None
    
    def _send(self, payload: dict[str, Any]) -> bytes:
        sock = self._socket()
        request_timeout = self.config.timeout
        params = payload.get("params") or {}
        if isinstance(params, dict) and params.get("timeout") is not None:
            request_timeout = max(request_timeout, float(params["timeout"]) + 1.0)
        sock.settimeout(request_timeout)
        line = (json.dumps(payload, separators=(",", ":")) + "\n").encode("utf-8")
        sock.sendall(line)
        return self._read_line(sock, self.config.max_response_bytes)
    
    def _socket(self) -> socket.socket:
        if self._sock is None:
            self._sock = socket.create_connection((self.config.host, self.config.port), self.config.timeout)
            self._sock.settimeout(self.config.timeout)
        return self._sock
    
    @staticmethod
    def _read_line(sock: socket.socket, max_bytes: int = 8 * 1024 * 1024) -> bytes:
        chunks: list[bytes] = []
        total = 0
        while True:
            chunk = sock.recv(4096)
            if not chunk:
                break
            total += len(chunk)
            if max_bytes >= 0 and total > max_bytes:
                raise OSError(f"Ableton bridge response exceeds {max_bytes} bytes")
            chunks.append(chunk)
            if b"\n" in chunk:
                break
        data = b"".join(chunks)
        if not data:
            raise OSError("No response from Ableton bridge")
        return data.split(b"\n", 1)[0]
Behavior3/5

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

No annotations are present, so description must carry the burden. It mentions the evaluation context and timeout, but does not disclose error behavior, side effects, or safety. Adequate but missing key behavioral details.

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?

Two sentences covering purpose, alternative, and preference. Every sentence adds value, no redundancy.

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

Completeness2/5

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

Despite concise purpose, the description omits essential context: return format, how ref works, error handling, and which bindings are available. With no output schema and many parameters, the agent cannot fully understand usage.

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

Parameters2/5

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

Schema coverage is only 14% (only timeout has a description). The tool description adds no explanation of expr, ref, detail, max_items, etc. With 7 parameters and a nested object, the lack of semantic detail hinders correct invocation.

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 it evaluates Python expressions with specific bindings (song, app, obj, Live). It distinguishes from sibling 'live_exec' by noting that live_exec is for statements, making the purpose specific and non-overlapping.

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?

Provides explicit guidance: use live_exec for statements, and prefer installed assets over generated unless asked. This helps the agent choose between tools, though it does not cover all possible contexts or exclusions.

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

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