|
| 1 | +# Epic 5: Enhance MCP `status` Command |
| 2 | + |
| 3 | +## 1. Goal |
| 4 | + |
| 5 | +To significantly enhance the `status` MCP command by providing a more comprehensive snapshot of the current Bitwig Studio state. This will give AI agents richer context, enabling more informed decisions and sophisticated interactions with the Bitwig environment. |
| 6 | + |
| 7 | +## 2. Background |
| 8 | + |
| 9 | +The existing `status` command returns minimal information (WigAI version and operational status). To allow for more intelligent agent behavior, it needs to convey key aspects of the Bitwig project, transport, selected track, selected clip slot, and selected device, including their parameters. This enhancement is inspired by the detailed information available via Bitwig's OSC interface. |
| 10 | + |
| 11 | +## 3. User Stories |
| 12 | + |
| 13 | +This epic will be broken down into the following stories: |
| 14 | + |
| 15 | +* **Story 5.1: Core Project and Transport Status** |
| 16 | + * As an AI agent, I want to retrieve the current project name and audio engine status, so I can confirm I'm working in the correct project and that audio is active. |
| 17 | + * As an AI agent, I want to know the current transport state (playing, recording, tempo, time signature, beat/time position), so I can synchronize my actions with Bitwig's playback. |
| 18 | +* **Story 5.2: Selected Track and Project Parameters Status** |
| 19 | + * As an AI agent, I want to access global project parameters, so I can read or potentially suggest modifications to them. |
| 20 | + * As an AI agent, I want to get information about the currently selected track (index, name, type, mute/solo/arm status), so I can perform track-specific operations. |
| 21 | +* **Story 5.3: Selected Device Status and Parameters** |
| 22 | + * As an AI agent, I want to get information about the currently selected device (track context, device index, name, bypass status, and its parameters), so I can understand and control the selected device. |
| 23 | +* **Story 5.4: Selected Clip Slot Status** |
| 24 | + * As an AI agent, I want to get information about the currently selected clip slot (track context, slot/scene indices, names, content status, playback/recording states), so I can interact with clips in the session view. |
| 25 | + |
| 26 | +## 4. Proposed Solution |
| 27 | + |
| 28 | +Modify the `StatusTool.java` to gather additional information from the Bitwig Studio API and return it in an expanded JSON structure. The MCP `status` command will no longer have a top-level `status` or `message` field from the tool's direct response; these will be handled by the MCP protocol wrapper if necessary. The `wigai_version` will remain. |
| 29 | + |
| 30 | +### Proposed JSON Response for `status` Command: |
| 31 | + |
| 32 | +```json |
| 33 | +{ |
| 34 | + "wigai_version": "x.y.z", |
| 35 | + "project_name": "Name of the project", |
| 36 | + "audio_engine_active": true, |
| 37 | + "project_parameters": [ |
| 38 | + { |
| 39 | + "index": 0, // 0-7, maps to OSC /project/param/{1-8} |
| 40 | + "exists": true, // From /project/param/{1-8}/exists |
| 41 | + "name": "Project Param 1 Name", // From /project/param/{1-8}/name |
| 42 | + "value": 0.5, // From /project/param/{1-8}/value (normalized 0.0-1.0 for consistency) |
| 43 | + "display_value": "50%" // From /project/param/{1-8}/valueStr |
| 44 | + } |
| 45 | + // ... up to 8 project parameters, only include if 'exists' is true |
| 46 | + ], |
| 47 | + "transport": { |
| 48 | + "playing": false, |
| 49 | + "recording": false, |
| 50 | + "repeat_active": true, |
| 51 | + "metronome_active": false, |
| 52 | + "current_tempo": 120.0, // From /tempo/raw |
| 53 | + "time_signature": "4/4", // From /time/signature |
| 54 | + "current_beat_str": "1.1.1:0", // From /beat/str (Bitwig format: measures.beats.sixteenths:ticks) |
| 55 | + "current_time_str": "0.0.0:0" // From /time/str (e.g., H.M.S:ms or M.S.ms) |
| 56 | + }, |
| 57 | + "selected_track": { |
| 58 | + "index": 0, // 0-based index of the track in the project |
| 59 | + "name": "Drums", // From /track/selected/name |
| 60 | + "type": "instrument", // From /track/selected/type (e.g., audio, instrument, hybrid, group, effect, master) |
| 61 | + "is_group": false, // From /track/selected/isGroup |
| 62 | + "muted": false, // From /track/selected/mute |
| 63 | + "soloed": false, // From /track/selected/solo |
| 64 | + "armed": true // From /track/selected/recarm |
| 65 | + }, |
| 66 | + "selected_clip_slot": { |
| 67 | + "track_name": "Drums", // Name of the track this slot belongs to |
| 68 | + "track_index": 0, // Index of the track this slot belongs to |
| 69 | + "slot_index": 0, // 0-based index of the clip slot on its track |
| 70 | + "scene_index": 0, // 0-based index of the scene this slot aligns with |
| 71 | + "scene_name": "Verse 1", // Name of the scene, null if scene is unnamed or not applicable |
| 72 | + "has_content": true, // true if a clip exists in this slot, false otherwise |
| 73 | + "clip_name": "Drum Loop 1", // Name of the clip if has_content is true, null otherwise |
| 74 | + "is_playing": false, |
| 75 | + "is_recording": false, |
| 76 | + "is_playback_queued": false, |
| 77 | + "is_recording_queued": false, |
| 78 | + "is_stop_queued": false |
| 79 | + }, |
| 80 | + "selected_device": { |
| 81 | + "track_name": "Drums", // Name of the track this device is on |
| 82 | + "track_index": 0, // Index of the track this device is on |
| 83 | + "index": 0, // 0-based index of the device in the track's device chain |
| 84 | + "name": "Polymer", // Name of the selected device |
| 85 | + "bypassed": false, // True if the device is currently bypassed |
| 86 | + "parameters": [ // Parameters of the selected device |
| 87 | + { |
| 88 | + "index": 0, // 0-7 |
| 89 | + "name": "Oscillator Mix", // From /device/param/{1-8}/name |
| 90 | + "value": 0.75, // From /device/param/{1-8}/value (normalized 0.0-1.0) |
| 91 | + "display_value": "75%" // From /device/param/{1-8}/valueStr |
| 92 | + } |
| 93 | + // ... up to 8 device parameters, only include if accessible/exists |
| 94 | + ] |
| 95 | + } |
| 96 | +} |
| 97 | +``` |
| 98 | + |
| 99 | +## 5. Technical Considerations |
| 100 | + |
| 101 | +* The `StatusTool.java` will need to interface with various parts of the Bitwig Studio Java API (Application, Project, Transport, Track, Device, ClipLauncherSlotBank, etc.) to retrieve the required information. |
| 102 | +* Care must be taken to handle cases where information might be unavailable (e.g., no device selected, no clip slot selected, project parameters not configured). In such cases, relevant fields should be `null` or omitted where appropriate (e.g., an empty array for parameters if none exist). |
| 103 | +* The `value` for parameters should be normalized (0.0-1.0) where applicable, consistent with `get_selected_device_parameters`. `display_value` will provide the formatted string. |
| 104 | +* Indices (`track_index`, `slot_index`, `scene_index`, `device.index`) should be 0-based. |
| 105 | +* The `api-reference.md` will need to be updated to reflect these changes to the `status` command's response. |
| 106 | + |
| 107 | +## 6. Acceptance Criteria |
| 108 | + |
| 109 | +* The `status` MCP command returns a JSON object matching the structure defined above. |
| 110 | +* All fields in the JSON response accurately reflect the current state of Bitwig Studio. |
| 111 | +* The `StatusTool.java` correctly queries the Bitwig API for all required data points. |
| 112 | +* The `api-reference.md` is updated with the new response format for the `status` command. |
| 113 | +* The changes are thoroughly tested for various Bitwig project states (e.g., empty project, project with content, different selections). |
| 114 | +* The tool gracefully handles scenarios where parts of the requested information are not available (e.g., no device selected, an empty clip slot selected). |
| 115 | + |
| 116 | +## 7. Out of Scope for this Epic |
| 117 | + |
| 118 | +* Adding new MCP commands to modify these states (they are covered by other tools or future epics). |
| 119 | +* Fetching exhaustive lists of all tracks, scenes, or devices (these would be separate, more specific tools). |
| 120 | +* Real-time event streaming of state changes (this `status` command is a poll/request-response). |
| 121 | + |
0 commit comments