add_pan_automation
Add a pan automation point on a track at a specified position, with pan values from -1.0 (full left) to 1.0 (full right). The pan envelope must be visible.
Instructions
Add a pan automation point on a track. The pan envelope must be visible in REAPER. pan: -1.0 (full left) to 1.0 (full right).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track_index | Yes | ||
| position | Yes | ||
| pan | Yes |
Implementation Reference
- src/reaper_mcp/mixing_tools.py:45-68 (handler)The actual handler function that adds a pan automation point on a track. It gets the project, finds the track by index, retrieves the Pan envelope via RPR.GetTrackEnvelopeByName, inserts a point with RPR.InsertEnvelopePoint, sorts points, and returns success/failure.
@mcp.tool() def add_pan_automation(track_index: int, position: float, pan: float) -> dict: """ Add a pan automation point on a track. The pan envelope must be visible in REAPER. pan: -1.0 (full left) to 1.0 (full right). """ try: project = get_project() track = project.tracks[track_index] envelope = RPR.GetTrackEnvelopeByName(track.id, "Pan") if not envelope: return { "success": False, "error": ( "Pan envelope not found. Show it first: right-click the track " "in REAPER and choose 'Show envelope for track pan'." ), } RPR.InsertEnvelopePoint(envelope, position, pan, 0, 0, False, True) RPR.Envelope_SortPoints(envelope) return {"success": True, "track_index": track_index, "position": position, "pan": pan} except Exception as e: return {"success": False, "error": str(e)} - src/reaper_mcp/server.py:8-28 (registration)Registration entry point: the server.py imports register_tools from mixing_tools (aliased as _reg_mixing) and calls it with the mcp instance, which registers add_pan_automation via the @mcp.tool() decorator.
# Import each tool module's register_tools function and call it with the mcp instance. # The imports must happen after mcp is created to avoid circular dependencies. from reaper_mcp.project_tools import register_tools as _reg_project from reaper_mcp.track_tools import register_tools as _reg_track from reaper_mcp.midi_tools import register_tools as _reg_midi from reaper_mcp.fx_tools import register_tools as _reg_fx from reaper_mcp.audio_tools import register_tools as _reg_audio from reaper_mcp.mixing_tools import register_tools as _reg_mixing from reaper_mcp.render_tools import register_tools as _reg_render from reaper_mcp.mastering_tools import register_tools as _reg_mastering from reaper_mcp.analysis_tools import register_tools as _reg_analysis _reg_project(mcp) _reg_track(mcp) _reg_midi(mcp) _reg_fx(mcp) _reg_audio(mcp) _reg_mixing(mcp) _reg_render(mcp) _reg_mastering(mcp) _reg_analysis(mcp) - src/reaper_mcp/connection.py:27-29 (helper)Helper function that ensures a connection to REAPER and returns the current project object, used by the handler to access tracks.
def get_project() -> reapy.Project: ensure_connected() return reapy.Project()