Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/mcp/src/automationTools/debug.ts
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
7
import { ApplicationService } from '../application';
8
import { z } from 'zod';
9
10
/**
11
* Debug Tools
12
*/
13
export function applyDebugTools(server: McpServer, appService: ApplicationService): RegisteredTool[] {
14
const tools: RegisteredTool[] = [];
15
tools.push(server.tool(
16
'vscode_automation_debug_open',
17
'Open the debug viewlet',
18
async () => {
19
const app = await appService.getOrCreateApplication();
20
await app.workbench.debug.openDebugViewlet();
21
return {
22
content: [{
23
type: 'text' as const,
24
text: 'Opened debug viewlet'
25
}]
26
};
27
}
28
));
29
30
tools.push(server.tool(
31
'vscode_automation_debug_set_breakpoint',
32
'Set a breakpoint on a specific line',
33
{
34
lineNumber: z.number().describe('Line number to set breakpoint on')
35
},
36
async (args) => {
37
const { lineNumber } = args;
38
const app = await appService.getOrCreateApplication();
39
await app.workbench.debug.setBreakpointOnLine(lineNumber);
40
return {
41
content: [{
42
type: 'text' as const,
43
text: `Set breakpoint on line ${lineNumber}`
44
}]
45
};
46
}
47
));
48
49
tools.push(server.tool(
50
'vscode_automation_debug_start',
51
'Start debugging',
52
async () => {
53
const app = await appService.getOrCreateApplication();
54
const result = await app.workbench.debug.startDebugging();
55
return {
56
content: [{
57
type: 'text' as const,
58
text: `Started debugging (result: ${result})`
59
}]
60
};
61
}
62
));
63
64
// Playwright can probably figure this out
65
// server.tool(
66
// 'vscode_automation_debug_stop',
67
// 'Stop debugging',
68
// async () => {
69
// await app.workbench.debug.stopDebugging();
70
// return {
71
// content: [{
72
// type: 'text' as const,
73
// text: 'Stopped debugging'
74
// }]
75
// };
76
// }
77
// );
78
79
// Playwright can probably figure this out
80
// server.tool(
81
// 'vscode_automation_debug_step_over',
82
// 'Step over in debugger',
83
// async () => {
84
// await app.workbench.debug.stepOver();
85
// return {
86
// content: [{
87
// type: 'text' as const,
88
// text: 'Stepped over'
89
// }]
90
// };
91
// }
92
// );
93
94
// Playwright can probably figure this out
95
// server.tool(
96
// 'vscode_automation_debug_step_in',
97
// 'Step into in debugger',
98
// async () => {
99
// await app.workbench.debug.stepIn();
100
// return {
101
// content: [{
102
// type: 'text' as const,
103
// text: 'Stepped in'
104
// }]
105
// };
106
// }
107
// );
108
109
// Playwright can probably figure this out
110
// server.tool(
111
// 'vscode_automation_debug_step_out',
112
// 'Step out in debugger',
113
// async () => {
114
// await app.workbench.debug.stepOut();
115
// return {
116
// content: [{
117
// type: 'text' as const,
118
// text: 'Stepped out'
119
// }]
120
// };
121
// }
122
// );
123
124
// Playwright can probably figure this out
125
// server.tool(
126
// 'vscode_automation_debug_continue',
127
// 'Continue execution in debugger',
128
// async () => {
129
// await app.workbench.debug.continue();
130
// return {
131
// content: [{
132
// type: 'text' as const,
133
// text: 'Continued execution'
134
// }]
135
// };
136
// }
137
// );
138
139
return tools;
140
}
141
142