set_track_pan
Set the pan balance of any track in REAPER with a value from -1.0 (full left) to 1.0 (full right), where 0.0 is center.
Instructions
Set track pan. -1.0 = full left, 0.0 = center, 1.0 = full right.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track_index | Yes | ||
| pan | Yes |
Implementation Reference
- src/reaper_mcp/track_tools.py:74-82 (handler)The function that executes the set_track_pan tool logic. Sets a track's pan value (-1.0 left to 1.0 right) using reapy.
def set_track_pan(track_index: int, pan: float) -> dict: """Set track pan. -1.0 = full left, 0.0 = center, 1.0 = full right.""" try: project = get_project() track = project.tracks[track_index] track.pan = pan return {"success": True, "track_index": track_index, "pan": track.pan} except Exception as e: return {"success": False, "error": str(e)} - src/reaper_mcp/track_tools.py:73-82 (registration)The @mcp.tool() decorator registers set_track_pan as an MCP tool. The registration happens when register_tools(mcp) is called from server.py.
@mcp.tool() def set_track_pan(track_index: int, pan: float) -> dict: """Set track pan. -1.0 = full left, 0.0 = center, 1.0 = full right.""" try: project = get_project() track = project.tracks[track_index] track.pan = pan return {"success": True, "track_index": track_index, "pan": track.pan} except Exception as e: return {"success": False, "error": str(e)} - src/reaper_mcp/server.py:21-21 (registration)server.py calls _reg_track(mcp) which invokes register_tools from track_tools.py, thus registering set_track_pan.
_reg_track(mcp) - src/reaper_mcp/connection.py:27-29 (helper)Helper function used by set_track_pan to get the REAPER project and ensure the API connection is active.
def get_project() -> reapy.Project: ensure_connected() return reapy.Project()