Skip to content

Commit 09c808e

Browse files
authored
[AXON-1978] Support /mcp command in Rovo Dev (not BBY) (#1666)
1 parent 403f00a commit 09c808e

File tree

7 files changed

+140
-109
lines changed

7 files changed

+140
-109
lines changed

CHANGELOG.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
### [Report an Issue](https://github.com/atlassian/atlascode/issues)
22

3-
## What's new in 4.0.24
4-
5-
### Improvements
6-
7-
- **RovoDev**: Enhanced "Fix by Rovo Dev" and "Explain by Rovo Dev" code actions with rich context extraction - now includes actual code content, surrounding code, import statements, and structured diagnostics for significantly better AI responses
8-
9-
### Bug Fixes
10-
11-
- **RovoDev**: Fixed chat message not appearing when clicking "Fix with Rovo Dev" before the chat view is fully initialized - now waits for the webview to be ready before executing the chat command
12-
- Fixed "Cannot read properties of undefined (reading 'initiateApiTokenAuth')" error
13-
14-
### Features
15-
16-
- **RovoDev**: Added copy code button within the Rovo Dev chat for code blocks in the chat.
17-
183
## What's new in 4.0.23
194

205
### Features
216

227
- **Rovo Dev**: Support new `plan` mode with `deferred_request` handling
8+
- **RovoDev**: Added copy code button within the Rovo Dev chat for code blocks in the chat.
239

2410
- **Rovo Dev**: Added Rovo Dev icon to the editor title bar for quick access — clicking it focuses the existing Rovo Dev sidebar panel
2511

@@ -32,14 +18,17 @@
3218
- **RovoDev**: Fixed prompt input performance degradation after extended idle periods by properly disposing Monaco editor resources and event listeners on component cleanup
3319
- **RovoDev**: Refactored JSON parsing logic with `safeJsonParse` helper function to reduce code duplication and improve maintainability
3420
- **RovoDev**: Centered text within tool call statements in RovoDev chat.
21+
- **RovoDev**: Enhanced "Fix by Rovo Dev" and "Explain by Rovo Dev" code actions with rich context extraction - now includes actual code content, surrounding code, import statements, and structured diagnostics for significantly better AI responses
3522

3623
### Bug Fixes
3724

3825
- Bitbucket DC: Fixed PRs list pagination
3926

4027
- **RovoDev**: Fixed JSON parsing errors in ToolReturnMessage handling - added type checking before JSON.parse() to prevent "Input data should be a String" and invalid JSON errors
41-
- Added comprehensive test coverage for parseToolReturnMessage with both string and pre-parsed object inputs
42-
- Rovo Dev: Unsupported slash commands now show a helpful warning instead of an error dialog
28+
- **Rovo Dev**: Unsupported slash commands now show a helpful warning instead of an error dialog
29+
- **Rovo Dev**: Added support for /mcp command
30+
- **RovoDev**: Fixed chat message not appearing when clicking "Fix with Rovo Dev" before the chat view is fully initialized - now waits for the webview to be ready before executing the chat command
31+
- Fixed "Cannot read properties of undefined (reading 'initiateApiTokenAuth')" error
4332

4433
## What's new in 4.0.22
4534

src/rovo-dev/rovoDevWebviewProvider.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,10 @@ export class RovoDevWebviewProvider extends Disposable implements WebviewViewPro
562562
await env.openExternal(Uri.parse(e.href));
563563
break;
564564

565+
case RovoDevViewResponseType.OpenMcpConfiguration:
566+
await commands.executeCommand(RovodevCommands.OpenRovoDevMcpJson);
567+
break;
568+
565569
case RovoDevViewResponseType.OpenRovoDevLogFile:
566570
await commands.executeCommand(RovodevCommands.OpenRovoDevLogFile);
567571
break;

src/rovo-dev/ui/prompt-box/prompt-input/PromptInput.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ describe('PromptInputBox', () => {
7878
sendButtonDisabled: false,
7979
onAddContext: jest.fn(),
8080
onCopy: jest.fn(),
81+
handleMcpConfigurationCommand: jest.fn(),
8182
handleMemoryCommand: jest.fn(),
8283
handleTriggerFeedbackCommand: jest.fn(),
8384
handleSessionCommand: jest.fn(),

src/rovo-dev/ui/prompt-box/prompt-input/PromptInput.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import {
2323
createMonacoPromptEditor,
2424
createPromptCompletionProvider,
2525
createSlashCommandProvider,
26+
getSlashCommands,
2627
removeMonacoStyles,
2728
setupAutoResize,
2829
setupMonacoCommands,
2930
setupPromptKeyBindings,
30-
SLASH_COMMANDS,
3131
} from './utils';
3232

3333
type NonDisabledState = Exclude<State, DisabledState>;
@@ -55,6 +55,7 @@ interface PromptInputBoxProps {
5555
onCancel: () => void;
5656
onAddContext: () => void;
5757
onCopy: () => void;
58+
handleMcpConfigurationCommand: () => void;
5859
handleMemoryCommand: () => void;
5960
handleTriggerFeedbackCommand: () => void;
6061
handleSessionCommand?: () => void;
@@ -85,11 +86,7 @@ let monacoInitialized = false;
8586

8687
function initMonaco(isBBY: boolean) {
8788
if (!monacoInitialized) {
88-
let commands = SLASH_COMMANDS;
89-
if (isBBY) {
90-
commands = commands.filter((command) => command.label !== '/yolo' && command.label !== '/sessions');
91-
}
92-
89+
const commands = getSlashCommands(isBBY).filter((command) => !command.disabled);
9390
monaco.languages.registerCompletionItemProvider('plaintext', createSlashCommandProvider(commands));
9491

9592
monacoInitialized = true;
@@ -131,6 +128,7 @@ export const PromptInputBox: React.FC<PromptInputBoxProps> = ({
131128
onCancel,
132129
onAddContext,
133130
onCopy,
131+
handleMcpConfigurationCommand,
134132
handleMemoryCommand,
135133
handleTriggerFeedbackCommand,
136134
handleSessionCommand,
@@ -229,6 +227,7 @@ export const PromptInputBox: React.FC<PromptInputBoxProps> = ({
229227
editor,
230228
onSend,
231229
onCopy,
230+
handleMcpConfigurationCommand,
232231
handleMemoryCommand,
233232
handleTriggerFeedbackCommand,
234233
handleSessionCommand,
@@ -243,6 +242,7 @@ export const PromptInputBox: React.FC<PromptInputBoxProps> = ({
243242
editor,
244243
onSend,
245244
onCopy,
245+
handleMcpConfigurationCommand,
246246
handleMemoryCommand,
247247
handleTriggerFeedbackCommand,
248248
onYoloModeToggled,

src/rovo-dev/ui/prompt-box/prompt-input/utils.tsx

Lines changed: 114 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -76,100 +76,120 @@ export const createMonacoPromptEditor = (container: HTMLElement) => {
7676
interface SlashCommand {
7777
label: string;
7878
insertText: string;
79+
disabled?: boolean;
7980
description?: string;
8081
command?: monaco.languages.Command;
8182
}
8283

83-
export const SLASH_COMMANDS: SlashCommand[] = [
84-
{
85-
label: '/clear',
86-
insertText: '/clear',
87-
description: 'Clear the chat',
88-
command: { title: 'Clear', id: 'rovo-dev.clearChat', tooltip: 'Clear the chat' },
89-
},
90-
{
91-
label: '/copy',
92-
insertText: '/copy',
93-
description: 'Copy the last response to clipboard',
94-
command: { title: 'Copy', id: 'rovo-dev.copyResponse', tooltip: 'Copy the last response to clipboard' },
95-
},
96-
{
97-
label: '/feedback',
98-
insertText: '/feedback',
99-
description: 'Provide feedback on Rovo Dev',
100-
command: { title: 'Feedback', id: 'rovo-dev.triggerFeedback', tooltip: 'Provide feedback on Rovo Dev' },
101-
},
102-
{
103-
label: '/memory',
104-
insertText: '/memory',
105-
description: 'Show agent memory',
106-
command: { title: 'Agent Memory', id: 'rovo-dev.agentMemory', tooltip: 'Show agent memory' },
107-
},
108-
{
109-
label: '/models',
110-
insertText: '/models',
111-
description: 'Show available agent models',
112-
command: {
113-
title: 'Models',
114-
id: 'rovo-dev.triggerAgentModels',
115-
tooltip: 'Show available agent models',
84+
export function getSlashCommands(isBBY: boolean): SlashCommand[] {
85+
return [
86+
{
87+
label: '/clear',
88+
insertText: '/clear',
89+
description: 'Clear the chat',
90+
command: { title: 'Clear', id: 'rovo-dev.clearChat', tooltip: 'Clear the chat' },
11691
},
117-
},
118-
{
119-
label: '/prompts',
120-
insertText: '!',
121-
description: 'Show saved prompts',
122-
command: {
123-
title: 'Prompts',
124-
id: 'rovo-dev.triggerPrompts',
125-
tooltip: 'Show saved prompts',
92+
{
93+
label: '/copy',
94+
insertText: '/copy',
95+
description: 'Copy the last response to clipboard',
96+
command: { title: 'Copy', id: 'rovo-dev.copyResponse', tooltip: 'Copy the last response to clipboard' },
12697
},
127-
},
128-
{
129-
label: '/prune',
130-
insertText: '/prune',
131-
description: 'Prune the chat',
132-
command: { title: 'Prune', id: 'rovo-dev.pruneChat', tooltip: 'Prune the chat' },
133-
},
134-
{
135-
label: '/status',
136-
insertText: '/status',
137-
description: 'Show Rovo Dev status including version, account details and model',
138-
command: {
139-
title: 'Status',
140-
id: 'rovo-dev.triggerStatus',
141-
tooltip: 'Show Rovo Dev status including version, account details and model',
98+
{
99+
label: '/feedback',
100+
insertText: '/feedback',
101+
description: 'Provide feedback on Rovo Dev',
102+
command: { title: 'Feedback', id: 'rovo-dev.triggerFeedback', tooltip: 'Provide feedback on Rovo Dev' },
142103
},
143-
},
144-
{
145-
label: '/usage',
146-
insertText: '/usage',
147-
description: 'Show Rovo Dev credit usage',
148-
command: {
149-
title: 'Usage',
150-
id: 'rovo-dev.triggerUsage',
151-
tooltip: 'Show Rovo Dev credit usage',
104+
{
105+
label: '/mcp',
106+
insertText: '',
107+
description: 'Open the MCP configuration file',
108+
command: {
109+
title: 'MCP configuration',
110+
id: 'rovo-dev.mcpConfiguration',
111+
tooltip: 'Open the MCP configuration file',
112+
},
113+
disabled: isBBY,
152114
},
153-
},
154-
{
155-
label: '/yolo',
156-
insertText: '/yolo',
157-
description: 'Toggle tool confirmations',
158-
command: { title: 'Yolo Mode', id: 'rovo-dev.toggleYoloMode', tooltip: 'Toggle tool confirmations' },
159-
},
160-
{
161-
label: '/ask',
162-
insertText: '/ask ',
163-
description: 'Ask a question in read-only mode (no file changes or terminal access)',
164-
command: { title: 'Ask Mode', id: 'rovo-dev.invokeAskMode', tooltip: 'Invoke Ask mode' },
165-
},
166-
{
167-
label: '/sessions',
168-
insertText: '/sessions',
169-
description: 'View and manage your agent sessions',
170-
command: { title: 'Sessions', id: 'rovo-dev.triggerSessions', tooltip: 'View and manage your agent sessions' },
171-
},
172-
];
115+
{
116+
label: '/memory',
117+
insertText: '/memory',
118+
description: 'Show agent memory',
119+
command: { title: 'Agent Memory', id: 'rovo-dev.agentMemory', tooltip: 'Show agent memory' },
120+
},
121+
{
122+
label: '/models',
123+
insertText: '/models',
124+
description: 'Show available agent models',
125+
command: {
126+
title: 'Models',
127+
id: 'rovo-dev.triggerAgentModels',
128+
tooltip: 'Show available agent models',
129+
},
130+
},
131+
{
132+
label: '/prompts',
133+
insertText: '!',
134+
description: 'Show saved prompts',
135+
command: {
136+
title: 'Prompts',
137+
id: 'rovo-dev.triggerPrompts',
138+
tooltip: 'Show saved prompts',
139+
},
140+
},
141+
{
142+
label: '/prune',
143+
insertText: '/prune',
144+
description: 'Prune the chat',
145+
command: { title: 'Prune', id: 'rovo-dev.pruneChat', tooltip: 'Prune the chat' },
146+
},
147+
{
148+
label: '/status',
149+
insertText: '/status',
150+
description: 'Show Rovo Dev status including version, account details and model',
151+
command: {
152+
title: 'Status',
153+
id: 'rovo-dev.triggerStatus',
154+
tooltip: 'Show Rovo Dev status including version, account details and model',
155+
},
156+
},
157+
{
158+
label: '/usage',
159+
insertText: '/usage',
160+
description: 'Show Rovo Dev credit usage',
161+
command: {
162+
title: 'Usage',
163+
id: 'rovo-dev.triggerUsage',
164+
tooltip: 'Show Rovo Dev credit usage',
165+
},
166+
},
167+
{
168+
label: '/yolo',
169+
insertText: '/yolo',
170+
description: 'Toggle tool confirmations',
171+
command: { title: 'Yolo Mode', id: 'rovo-dev.toggleYoloMode', tooltip: 'Toggle tool confirmations' },
172+
disabled: isBBY,
173+
},
174+
{
175+
label: '/ask',
176+
insertText: '/ask ',
177+
description: 'Ask a question in read-only mode (no file changes or terminal access)',
178+
command: { title: 'Ask Mode', id: 'rovo-dev.invokeAskMode', tooltip: 'Invoke Ask mode' },
179+
},
180+
{
181+
label: '/sessions',
182+
insertText: '/sessions',
183+
description: 'View and manage your agent sessions',
184+
command: {
185+
title: 'Sessions',
186+
id: 'rovo-dev.triggerSessions',
187+
tooltip: 'View and manage your agent sessions',
188+
},
189+
disabled: isBBY,
190+
},
191+
];
192+
}
173193

174194
export const createSlashCommandProvider = (commands: SlashCommand[]): monaco.languages.CompletionItemProvider => {
175195
return {
@@ -279,6 +299,7 @@ export function setupMonacoCommands(
279299
editor: monaco.editor.IStandaloneCodeEditor,
280300
onSend: (text: string) => boolean,
281301
onCopy: () => void,
302+
handleMcpConfigurationCommand: () => void,
282303
handleMemoryCommand: () => void,
283304
handleTriggerFeedbackCommand: () => void,
284305
handleSessionCommand?: () => void,
@@ -316,6 +337,13 @@ export function setupMonacoCommands(
316337
}),
317338
);
318339

340+
disposables.push(
341+
monaco.editor.registerCommand('rovo-dev.mcpConfiguration', () => {
342+
handleMcpConfigurationCommand();
343+
editor.setValue('');
344+
}),
345+
);
346+
319347
disposables.push(
320348
monaco.editor.registerCommand('rovo-dev.triggerPrompts', () => {
321349
// Trigger suggestions for saved prompts

src/rovo-dev/ui/rovoDevView.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,12 @@ const RovoDevView: React.FC = () => {
809809
navigator.clipboard?.writeText(lastMessage.content);
810810
}, [currentState, history]);
811811

812+
const executeOpenMcpConfigurationFile = useCallback(() => {
813+
postMessage({
814+
type: RovoDevViewResponseType.OpenMcpConfiguration,
815+
});
816+
}, [postMessage]);
817+
812818
const executeGetAgentMemory = useCallback(() => {
813819
postMessage({
814820
type: RovoDevViewResponseType.GetAgentMemory,
@@ -1237,6 +1243,7 @@ const RovoDevView: React.FC = () => {
12371243
onCancel={cancelResponse}
12381244
onAddContext={onAddContext}
12391245
onCopy={handleCopyResponse}
1246+
handleMcpConfigurationCommand={executeOpenMcpConfigurationFile}
12401247
handleMemoryCommand={executeGetAgentMemory}
12411248
handleTriggerFeedbackCommand={handleShowFeedbackForm}
12421249
promptText={promptText}

src/rovo-dev/ui/rovoDevViewMessages.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const enum RovoDevViewResponseType {
2828
ReportCreatePrButtonClicked = 'reportCreatePrButtonClicked',
2929
CheckGitChanges = 'checkGitChanges',
3030
WebviewReady = 'webviewReady',
31+
OpenMcpConfiguration = 'openMcpConfiguration',
3132
GetAgentMemory = 'getAgentMemory',
3233
TriggerFeedback = 'triggerFeedback',
3334
SendFeedback = 'sendFeedback',
@@ -86,6 +87,7 @@ export type RovoDevViewResponse =
8687
| ReducerAction<RovoDevViewResponseType.ReportCreatePrButtonClicked>
8788
| ReducerAction<RovoDevViewResponseType.CheckGitChanges>
8889
| ReducerAction<RovoDevViewResponseType.WebviewReady>
90+
| ReducerAction<RovoDevViewResponseType.OpenMcpConfiguration>
8991
| ReducerAction<RovoDevViewResponseType.GetAgentMemory>
9092
| ReducerAction<RovoDevViewResponseType.TriggerFeedback>
9193
| ReducerAction<

0 commit comments

Comments
 (0)