debugger-mcp-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +73 -0
- package/README.md +108 -0
- package/dist/bridge/bridgeClient.d.ts +5 -0
- package/dist/bridge/bridgeClient.js +33 -0
- package/dist/bridge/bridgeClient.js.map +1 -0
- package/dist/bridge/bridgeTypes.d.ts +61 -0
- package/dist/bridge/bridgeTypes.js +2 -0
- package/dist/bridge/bridgeTypes.js.map +1 -0
- package/dist/bridge/connectionManager.d.ts +2 -0
- package/dist/bridge/connectionManager.js +67 -0
- package/dist/bridge/connectionManager.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +124 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/analysis/analyzeCode.d.ts +4 -0
- package/dist/tools/analysis/analyzeCode.js +26 -0
- package/dist/tools/analysis/analyzeCode.js.map +1 -0
- package/dist/tools/breakpoints/listBreakpoints.d.ts +4 -0
- package/dist/tools/breakpoints/listBreakpoints.js +16 -0
- package/dist/tools/breakpoints/listBreakpoints.js.map +1 -0
- package/dist/tools/breakpoints/removeBreakpoints.d.ts +4 -0
- package/dist/tools/breakpoints/removeBreakpoints.js +22 -0
- package/dist/tools/breakpoints/removeBreakpoints.js.map +1 -0
- package/dist/tools/breakpoints/setBreakpoints.d.ts +4 -0
- package/dist/tools/breakpoints/setBreakpoints.js +29 -0
- package/dist/tools/breakpoints/setBreakpoints.js.map +1 -0
- package/dist/tools/debugSession/continueExecution.d.ts +4 -0
- package/dist/tools/debugSession/continueExecution.js +24 -0
- package/dist/tools/debugSession/continueExecution.js.map +1 -0
- package/dist/tools/debugSession/evaluateExpression.d.ts +4 -0
- package/dist/tools/debugSession/evaluateExpression.js +28 -0
- package/dist/tools/debugSession/evaluateExpression.js.map +1 -0
- package/dist/tools/debugSession/getCallStack.d.ts +4 -0
- package/dist/tools/debugSession/getCallStack.js +24 -0
- package/dist/tools/debugSession/getCallStack.js.map +1 -0
- package/dist/tools/debugSession/getVariables.d.ts +4 -0
- package/dist/tools/debugSession/getVariables.js +26 -0
- package/dist/tools/debugSession/getVariables.js.map +1 -0
- package/dist/tools/debugSession/startDebugSession.d.ts +4 -0
- package/dist/tools/debugSession/startDebugSession.js +34 -0
- package/dist/tools/debugSession/startDebugSession.js.map +1 -0
- package/dist/tools/debugSession/stepInto.d.ts +4 -0
- package/dist/tools/debugSession/stepInto.js +24 -0
- package/dist/tools/debugSession/stepInto.js.map +1 -0
- package/dist/tools/debugSession/stepOut.d.ts +4 -0
- package/dist/tools/debugSession/stepOut.js +24 -0
- package/dist/tools/debugSession/stepOut.js.map +1 -0
- package/dist/tools/debugSession/stepOver.d.ts +4 -0
- package/dist/tools/debugSession/stepOver.js +24 -0
- package/dist/tools/debugSession/stepOver.js.map +1 -0
- package/dist/tools/debugSession/stopDebugSession.d.ts +4 -0
- package/dist/tools/debugSession/stopDebugSession.js +22 -0
- package/dist/tools/debugSession/stopDebugSession.js.map +1 -0
- package/dist/tools/toolRegistry.d.ts +4 -0
- package/dist/tools/toolRegistry.js +29 -0
- package/dist/tools/toolRegistry.js.map +1 -0
- package/dist/tools/toolTypes.d.ts +6 -0
- package/dist/tools/toolTypes.js +8 -0
- package/dist/tools/toolTypes.js.map +1 -0
- package/package.json +23 -0
- package/src/bridge/bridgeClient.ts +40 -0
- package/src/bridge/bridgeTypes.ts +70 -0
- package/src/bridge/connectionManager.ts +82 -0
- package/src/index.ts +10 -0
- package/src/server.ts +143 -0
- package/src/tools/analysis/analyzeCode.ts +33 -0
- package/src/tools/breakpoints/listBreakpoints.ts +23 -0
- package/src/tools/breakpoints/removeBreakpoints.ts +28 -0
- package/src/tools/breakpoints/setBreakpoints.ts +37 -0
- package/src/tools/debugSession/continueExecution.ts +30 -0
- package/src/tools/debugSession/evaluateExpression.ts +34 -0
- package/src/tools/debugSession/getCallStack.ts +30 -0
- package/src/tools/debugSession/getVariables.ts +32 -0
- package/src/tools/debugSession/startDebugSession.ts +40 -0
- package/src/tools/debugSession/stepInto.ts +30 -0
- package/src/tools/debugSession/stepOut.ts +30 -0
- package/src/tools/debugSession/stepOver.ts +30 -0
- package/src/tools/debugSession/stopDebugSession.ts +28 -0
- package/src/tools/toolRegistry.ts +30 -0
- package/src/tools/toolTypes.ts +8 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerSetBreakpointsTool = (params) => {
|
|
5
|
+
params.server.tool("set_breakpoints", "Set breakpoints at specified file locations. Optionally clear existing breakpoints first.", {
|
|
6
|
+
locations: z.array(z.object({
|
|
7
|
+
filePath: z.string().describe("Absolute or workspace-relative file path"),
|
|
8
|
+
lineNumber: z.number().describe("Line number to set breakpoint on"),
|
|
9
|
+
condition: z.string().optional().describe("Conditional expression for the breakpoint"),
|
|
10
|
+
logMessage: z.string().optional().describe("Log message (logpoint) instead of breaking"),
|
|
11
|
+
})).describe("Array of breakpoint locations to set"),
|
|
12
|
+
shouldClearExisting: z.boolean().default(false).describe("Clear all existing breakpoints before setting new ones"),
|
|
13
|
+
}, async (args) => {
|
|
14
|
+
try {
|
|
15
|
+
const result = await sendBridgeCommand({
|
|
16
|
+
command: "setBreakpoints",
|
|
17
|
+
args: {
|
|
18
|
+
locations: args.locations,
|
|
19
|
+
shouldClearExisting: args.shouldClearExisting,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+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AAI,CAAC,mBAAmB;iBAC9C;aACF,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerContinueExecutionTool = (params) => {
|
|
5
|
+
params.server.tool("continue_execution", "Continue execution until the next breakpoint or program termination.", {
|
|
6
|
+
sessionId: z.string().optional().describe("Debug session ID. Defaults to the active session."),
|
|
7
|
+
threadId: z.number().optional().describe("Thread ID to continue. Defaults to the first available thread."),
|
|
8
|
+
}, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await sendBridgeCommand({
|
|
11
|
+
command: "continueExecution",
|
|
12
|
+
args: {
|
|
13
|
+
sessionId: args.sessionId,
|
|
14
|
+
threadId: args.threadId,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=continueExecution.js.map
|
|
@@ -0,0 +1 @@
|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AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerEvaluateExpressionTool = (params) => {
|
|
5
|
+
params.server.tool("evaluate_expression", "Evaluate an expression in the context of the current debug session. Useful for inspecting values, calling functions, or testing conditions.", {
|
|
6
|
+
expression: z.string().describe("The expression to evaluate"),
|
|
7
|
+
sessionId: z.string().optional().describe("Debug session ID. Defaults to the active session."),
|
|
8
|
+
frameId: z.number().optional().describe("Stack frame ID for evaluation context. Defaults to the top frame."),
|
|
9
|
+
context: z.enum(["watch", "repl", "hover"]).optional().describe("Evaluation context type. Defaults to 'repl'."),
|
|
10
|
+
}, async (args) => {
|
|
11
|
+
try {
|
|
12
|
+
const result = await sendBridgeCommand({
|
|
13
|
+
command: "evaluateExpression",
|
|
14
|
+
args: {
|
|
15
|
+
expression: args.expression,
|
|
16
|
+
sessionId: args.sessionId,
|
|
17
|
+
frameId: args.frameId,
|
|
18
|
+
context: args.context,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=evaluateExpression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluateExpression.js","sourceRoot":"","sources":["../../../src/tools/debugSession/evaluateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,M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E,IAAI,EAAE,CAAC;QACrG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerGetCallStackTool = (params) => {
|
|
5
|
+
params.server.tool("get_call_stack", "Get the current call stack (stack trace) showing the chain of function calls.", {
|
|
6
|
+
sessionId: z.string().optional().describe("Debug session ID. Defaults to the active session."),
|
|
7
|
+
threadId: z.number().optional().describe("Thread ID to get call stack for. Defaults to the first available thread."),
|
|
8
|
+
}, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await sendBridgeCommand({
|
|
11
|
+
command: "getCallStack",
|
|
12
|
+
args: {
|
|
13
|
+
sessionId: args.sessionId,
|
|
14
|
+
threadId: args.threadId,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=getCallStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCallStack.js","sourceRoot":"","sources":["../../../src/tools/debugSession/getCallStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAA6B,EAAQ,EAAE;IAC9E,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB,gBAAgB,EAChB,+EAA+E,EAC/E;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;QAC9F,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0EAA0E,CAAC;KACrH,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAuB;gBAC3D,OAAO,EAAE,cAAc;gBACvB,IAAI,EAAE;oBACJ,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB;aACF,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerGetVariablesTool = (params) => {
|
|
5
|
+
params.server.tool("get_variables", "Get variables visible at the current debug position. Returns all scopes (local, closure, global) by default.", {
|
|
6
|
+
sessionId: z.string().optional().describe("Debug session ID. Defaults to the active session."),
|
|
7
|
+
frameId: z.number().optional().describe("Stack frame ID to get variables for. Defaults to the top frame."),
|
|
8
|
+
variablesReference: z.number().optional().describe("Specific variables reference to expand (for nested objects)."),
|
|
9
|
+
}, async (args) => {
|
|
10
|
+
try {
|
|
11
|
+
const result = await sendBridgeCommand({
|
|
12
|
+
command: "getVariables",
|
|
13
|
+
args: {
|
|
14
|
+
sessionId: args.sessionId,
|
|
15
|
+
frameId: args.frameId,
|
|
16
|
+
variablesReference: args.variablesReference,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=getVariables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVariables.js","sourceRoot":"","sources":["../../../src/tools/debugSession/getVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAA6B,EAAQ,EAAE;IAC9E,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB,eAAe,EACf,8GAA8G,EAC9G;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;QAC9F,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;QAC1G,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8DAA8D,CAAC;KACnH,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAuB;gBAC3D,OAAO,EAAE,cAAc;gBACvB,IAAI,EAAE;oBACJ,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;iBAC5C;aACF,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerStartDebugSessionTool = (params) => {
|
|
5
|
+
params.server.tool("start_debug_session", "Start a new debug session in VS Code. Supports launching programs or attaching to running processes.", {
|
|
6
|
+
type: z.string().describe("Debug adapter type (e.g., 'node', 'python', 'cppdbg')"),
|
|
7
|
+
name: z.string().describe("Human-readable name for the debug session"),
|
|
8
|
+
request: z.enum(["launch", "attach"]).describe("Whether to launch a new process or attach to existing"),
|
|
9
|
+
program: z.string().optional().describe("Path to the program to debug"),
|
|
10
|
+
args: z.array(z.string()).optional().describe("Command line arguments for the program"),
|
|
11
|
+
cwd: z.string().optional().describe("Working directory for the program"),
|
|
12
|
+
additionalConfig: z.record(z.unknown()).optional().describe("Additional debug configuration properties passed to the debug adapter"),
|
|
13
|
+
}, async (args) => {
|
|
14
|
+
try {
|
|
15
|
+
const result = await sendBridgeCommand({
|
|
16
|
+
command: "startDebugSession",
|
|
17
|
+
args: {
|
|
18
|
+
type: args.type,
|
|
19
|
+
name: args.name,
|
|
20
|
+
request: args.request,
|
|
21
|
+
program: args.program,
|
|
22
|
+
args: args.args,
|
|
23
|
+
cwd: args.cwd,
|
|
24
|
+
additionalConfig: args.additionalConfig,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=startDebugSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startDebugSession.js","sourceRoot":"","sources":["../../../src/tools/debugSession/startDebugSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,MAA6B,EAAQ,EAAE;IACnF,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB,qBAAqB,EACrB,sGAAsG,EACtG;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;QAClF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;QACtE,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,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,EAAE,IAAI,EAAE,CAAC;QACrG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerStepIntoTool = (params) => {
|
|
5
|
+
params.server.tool("step_into", "Step into the function call at the current line in the debugger.", {
|
|
6
|
+
sessionId: z.string().optional().describe("Debug session ID. Defaults to the active session."),
|
|
7
|
+
threadId: z.number().optional().describe("Thread ID to step. Defaults to the first available thread."),
|
|
8
|
+
}, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await sendBridgeCommand({
|
|
11
|
+
command: "stepInto",
|
|
12
|
+
args: {
|
|
13
|
+
sessionId: args.sessionId,
|
|
14
|
+
threadId: args.threadId,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=stepInto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepInto.js","sourceRoot":"","sources":["../../../src/tools/debugSession/stepInto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAA6B,EAAQ,EAAE;IAC1E,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB,WAAW,EACX,kEAAkE,EAClE;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;QAC9F,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;KACvG,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAe;gBACnD,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE;oBACJ,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB;aACF,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerStepOutTool = (params) => {
|
|
5
|
+
params.server.tool("step_out", "Step out of the current function, returning to the caller.", {
|
|
6
|
+
sessionId: z.string().optional().describe("Debug session ID. Defaults to the active session."),
|
|
7
|
+
threadId: z.number().optional().describe("Thread ID to step. Defaults to the first available thread."),
|
|
8
|
+
}, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await sendBridgeCommand({
|
|
11
|
+
command: "stepOut",
|
|
12
|
+
args: {
|
|
13
|
+
sessionId: args.sessionId,
|
|
14
|
+
threadId: args.threadId,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=stepOut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepOut.js","sourceRoot":"","sources":["../../../src/tools/debugSession/stepOut.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAA6B,EAAQ,EAAE;IACzE,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB,UAAU,EACV,4DAA4D,EAC5D;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;QAC9F,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;KACvG,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAe;gBACnD,OAAO,EAAE,SAAS;gBAClB,IAAI,EAAE;oBACJ,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB;aACF,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerStepOverTool = (params) => {
|
|
5
|
+
params.server.tool("step_over", "Step over the current line in the debugger, executing it without stepping into function calls.", {
|
|
6
|
+
sessionId: z.string().optional().describe("Debug session ID. Defaults to the active session."),
|
|
7
|
+
threadId: z.number().optional().describe("Thread ID to step. Defaults to the first available thread."),
|
|
8
|
+
}, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await sendBridgeCommand({
|
|
11
|
+
command: "stepOver",
|
|
12
|
+
args: {
|
|
13
|
+
sessionId: args.sessionId,
|
|
14
|
+
threadId: args.threadId,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=stepOver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepOver.js","sourceRoot":"","sources":["../../../src/tools/debugSession/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
2
|
+
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
+
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
+
export const registerStopDebugSessionTool = (params) => {
|
|
5
|
+
params.server.tool("stop_debug_session", "Stop an active debug session. If no session ID is provided, stops the currently active session.", {
|
|
6
|
+
sessionId: z.string().optional().describe("ID of the debug session to stop. Omit for the active session."),
|
|
7
|
+
}, async (args) => {
|
|
8
|
+
try {
|
|
9
|
+
const result = await sendBridgeCommand({
|
|
10
|
+
command: "stopDebugSession",
|
|
11
|
+
args: {
|
|
12
|
+
sessionId: args.sessionId,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=stopDebugSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopDebugSession.js","sourceRoot":"","sources":["../../../src/tools/debugSession/stopDebugSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,MAA6B,EAAQ,EAAE;IAClF,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB,oBAAoB,EACpB,iGAAiG,EACjG;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;KAC3G,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAA2B;gBAC/D,OAAO,EAAE,kBAAkB;gBAC3B,IAAI,EAAE;oBACJ,SAAS,EAAE,IAAI,CAAC,SAAS;iBAC1B;aACF,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { registerAnalyzeCodeTool } from "./analysis/analyzeCode.js";
|
|
2
|
+
import { registerSetBreakpointsTool } from "./breakpoints/setBreakpoints.js";
|
|
3
|
+
import { registerRemoveBreakpointsTool } from "./breakpoints/removeBreakpoints.js";
|
|
4
|
+
import { registerListBreakpointsTool } from "./breakpoints/listBreakpoints.js";
|
|
5
|
+
import { registerStartDebugSessionTool } from "./debugSession/startDebugSession.js";
|
|
6
|
+
import { registerStopDebugSessionTool } from "./debugSession/stopDebugSession.js";
|
|
7
|
+
import { registerStepOverTool } from "./debugSession/stepOver.js";
|
|
8
|
+
import { registerStepIntoTool } from "./debugSession/stepInto.js";
|
|
9
|
+
import { registerStepOutTool } from "./debugSession/stepOut.js";
|
|
10
|
+
import { registerContinueExecutionTool } from "./debugSession/continueExecution.js";
|
|
11
|
+
import { registerGetVariablesTool } from "./debugSession/getVariables.js";
|
|
12
|
+
import { registerGetCallStackTool } from "./debugSession/getCallStack.js";
|
|
13
|
+
import { registerEvaluateExpressionTool } from "./debugSession/evaluateExpression.js";
|
|
14
|
+
export const registerAllTools = (params) => {
|
|
15
|
+
registerAnalyzeCodeTool(params);
|
|
16
|
+
registerSetBreakpointsTool(params);
|
|
17
|
+
registerRemoveBreakpointsTool(params);
|
|
18
|
+
registerListBreakpointsTool(params);
|
|
19
|
+
registerStartDebugSessionTool(params);
|
|
20
|
+
registerStopDebugSessionTool(params);
|
|
21
|
+
registerStepOverTool(params);
|
|
22
|
+
registerStepIntoTool(params);
|
|
23
|
+
registerStepOutTool(params);
|
|
24
|
+
registerContinueExecutionTool(params);
|
|
25
|
+
registerGetVariablesTool(params);
|
|
26
|
+
registerGetCallStackTool(params);
|
|
27
|
+
registerEvaluateExpressionTool(params);
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=toolRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolRegistry.js","sourceRoot":"","sources":["../../src/tools/toolRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAA6B,EAAQ,EAAE;IACtE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,0BAA0B,CAAC,MAAM,CAAC,CAAC;IACnC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACpC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,4BAA4B,CAAC,MAAM,CAAC,CAAC;IACrC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,8BAA8B,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const formatToolResult = (params) => {
|
|
2
|
+
return JSON.stringify(params.data, null, 2);
|
|
3
|
+
};
|
|
4
|
+
export const formatErrorResult = (params) => {
|
|
5
|
+
const message = params.error instanceof Error ? params.error.message : String(params.error);
|
|
6
|
+
return `Error: ${message}`;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=toolTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolTypes.js","sourceRoot":"","sources":["../../src/tools/toolTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAyB,EAAU,EAAE;IACpE,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA0B,EAAU,EAAE;IACtE,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5F,OAAO,UAAU,OAAO,EAAE,CAAC;AAC7B,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "debugger-mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for VS Code debugging via bridge extension",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"dev": "tsx src/index.ts",
|
|
10
|
+
"start": "node dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
14
|
+
"express": "^4.21.0",
|
|
15
|
+
"zod": "^3.24.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/express": "^5.0.0",
|
|
19
|
+
"@types/node": "^22.0.0",
|
|
20
|
+
"tsx": "^4.0.0",
|
|
21
|
+
"typescript": "^5.7.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getBridgeUrl, invalidateCache } from "./connectionManager.js";
|
|
2
|
+
|
|
3
|
+
const DEFAULT_TIMEOUT_MS = 30000;
|
|
4
|
+
|
|
5
|
+
export const sendBridgeCommand = async <T>(params: {
|
|
6
|
+
command: string;
|
|
7
|
+
args?: Record<string, unknown>;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
}): Promise<T> => {
|
|
10
|
+
const { command, args = {}, timeoutMs = DEFAULT_TIMEOUT_MS } = params;
|
|
11
|
+
|
|
12
|
+
const bridgeUrl = await getBridgeUrl();
|
|
13
|
+
const controller = new AbortController();
|
|
14
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetch(`${bridgeUrl}/api/${command}`, {
|
|
18
|
+
method: "POST",
|
|
19
|
+
headers: { "Content-Type": "application/json" },
|
|
20
|
+
body: JSON.stringify(args),
|
|
21
|
+
signal: controller.signal,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const errorBody = await response.text();
|
|
26
|
+
invalidateCache();
|
|
27
|
+
throw new Error(`Bridge command "${command}" failed (${response.status}): ${errorBody}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (await response.json()) as T;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
33
|
+
invalidateCache();
|
|
34
|
+
throw new Error(`Bridge command "${command}" timed out after ${timeoutMs}ms.`);
|
|
35
|
+
}
|
|
36
|
+
throw error;
|
|
37
|
+
} finally {
|
|
38
|
+
clearTimeout(timeout);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface BridgeHealthResponse {
|
|
2
|
+
status: "ok";
|
|
3
|
+
extensionVersion: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface BreakpointLocation {
|
|
7
|
+
filePath: string;
|
|
8
|
+
lineNumber: number;
|
|
9
|
+
condition?: string;
|
|
10
|
+
logMessage?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface BreakpointInfo {
|
|
14
|
+
id: string;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
location?: { filePath: string; lineNumber: number };
|
|
17
|
+
condition?: string;
|
|
18
|
+
hitCondition?: string;
|
|
19
|
+
logMessage?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SetBreakpointsResponse {
|
|
23
|
+
successCount: number;
|
|
24
|
+
failedPaths: string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface RemoveBreakpointsResponse {
|
|
28
|
+
removedCount: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ListBreakpointsResponse {
|
|
32
|
+
breakpoints: BreakpointInfo[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface AnalyzeCodeResponse {
|
|
36
|
+
locations: Array<{
|
|
37
|
+
filePath: string;
|
|
38
|
+
lineNumber: number;
|
|
39
|
+
codeSnippet: string;
|
|
40
|
+
reason: string;
|
|
41
|
+
}>;
|
|
42
|
+
summary: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface StartDebugSessionResponse {
|
|
46
|
+
sessionId: string;
|
|
47
|
+
name: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface StopDebugSessionResponse {
|
|
51
|
+
stopped: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface StepResponse {
|
|
55
|
+
success: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface GetVariablesResponse {
|
|
59
|
+
variables: unknown[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface GetCallStackResponse {
|
|
63
|
+
stackFrames: unknown[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface EvaluateExpressionResponse {
|
|
67
|
+
result: string;
|
|
68
|
+
type?: string;
|
|
69
|
+
variablesReference?: number;
|
|
70
|
+
}
|