stop_transport
Stop ongoing audio playback or recording in REAPER projects.
Instructions
Stop playback or recording.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/reaper_mcp/audio_tools.py:63-69 (handler)The stop_transport handler function that uses RPR.Main_OnCommand(1016, 0) to stop playback or recording, returning success/failure response.
def stop_transport() -> dict: """Stop playback or recording.""" try: RPR.Main_OnCommand(1016, 0) # Transport: Stop return {"success": True, "message": "Transport stopped"} except Exception as e: return {"success": False, "error": str(e)} - src/reaper_mcp/audio_tools.py:62-69 (schema)The @mcp.tool() decorator and function signature define the schema - no parameters, returns dict with success/message or success/error.
@mcp.tool() def stop_transport() -> dict: """Stop playback or recording.""" try: RPR.Main_OnCommand(1016, 0) # Transport: Stop return {"success": True, "message": "Transport stopped"} except Exception as e: return {"success": False, "error": str(e)} - src/reaper_mcp/server.py:14-14 (registration)The audio_tools module (containing stop_transport) is imported from reaper_mcp.audio_tools as _reg_audio and called with mcp at line 24.
from reaper_mcp.audio_tools import register_tools as _reg_audio - src/reaper_mcp/audio_tools.py:12-69 (registration)The register_tools function defines stop_transport via the @mcp.tool() decorator pattern, registering it as an MCP tool.
def register_tools(mcp): @mcp.tool() def import_audio_file(file_path: str, track_index: int, position: float = 0.0) -> dict: """ Import an audio file onto a track at the given position (seconds). Supports all formats REAPER can read: wav, aiff, mp3, flac, ogg, etc. """ try: if not os.path.exists(file_path): return {"success": False, "error": f"File not found: {file_path}"} project = get_project() track = project.tracks[track_index] # Select only this track, set cursor, then insert media at cursor RPR.SetOnlyTrackSelected(track.id) project.cursor_position = position RPR.InsertMedia(file_path, 0) # Retrieve the item that was just created (last item on the track) track_refreshed = project.tracks[track_index] if track_refreshed.n_items == 0: return {"success": False, "error": "Insert succeeded but no item found on track"} item = track_refreshed.items[track_refreshed.n_items - 1] return { "success": True, "track_index": track_index, "item_index": track_refreshed.n_items - 1, "position": item.position, "length": item.length, "file_path": file_path, } except Exception as e: logger.error(f"import_audio_file failed: {e}") return {"success": False, "error": str(e)} @mcp.tool() def start_recording(track_index: int) -> dict: """Arm a track and start recording. Call stop_transport when done.""" try: project = get_project() track = project.tracks[track_index] track.armed = True RPR.Main_OnCommand(1013, 0) # Transport: Record return { "success": True, "track_index": track_index, "message": "Recording started. Call stop_transport to stop.", } except Exception as e: return {"success": False, "error": str(e)} @mcp.tool() def stop_transport() -> dict: """Stop playback or recording.""" try: RPR.Main_OnCommand(1016, 0) # Transport: Stop return {"success": True, "message": "Transport stopped"} except Exception as e: return {"success": False, "error": str(e)}