setBreakpoint
Set a breakpoint in Go programs during debugging sessions by specifying the file, line number, and optional condition using the Delve debugger interface.
Instructions
Set a breakpoint in the debugged program
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| condition | No | Optional condition for the breakpoint | |
| file | Yes | File path where to set the breakpoint | |
| line | Yes | Line number for the breakpoint | |
| sessionId | Yes | ID of the debug session |
Implementation Reference
- src/handlers/control.ts:15-37 (handler)The switch case that implements the core logic of the setBreakpoint tool. It extracts file, line, and optional condition from args, sends a CreateBreakpoint command to the Delve debug session, stores the breakpoint in the session, and returns a confirmation message.case "setBreakpoint": { const { file, line, condition } = args; const response = await sendDelveCommand(session, "CreateBreakpoint", { file, line, cond: condition }); const bp: Breakpoint = { id: response.id, file, line, condition }; session.breakpoints.set(bp.id, bp); return { content: [{ type: "text", text: `Set breakpoint ${bp.id} at ${file}:${line}` }] }; }
- src/server.ts:140-161 (schema)Input schema defining the parameters for the setBreakpoint tool: required sessionId, file, line; optional condition.inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "ID of the debug session" }, file: { type: "string", description: "File path where to set the breakpoint" }, line: { type: "number", description: "Line number for the breakpoint" }, condition: { type: "string", description: "Optional condition for the breakpoint" } }, required: ["sessionId", "file", "line"] }
- src/server.ts:137-162 (registration)Registration of the setBreakpoint tool in the list of tools returned by listTools, including name, description, and input schema.{ name: "setBreakpoint", description: "Set a breakpoint in the debugged program", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "ID of the debug session" }, file: { type: "string", description: "File path where to set the breakpoint" }, line: { type: "number", description: "Line number for the breakpoint" }, condition: { type: "string", description: "Optional condition for the breakpoint" } }, required: ["sessionId", "file", "line"] } },
- src/server.ts:410-413 (handler)Routing logic in the CallToolRequestHandler that directs setBreakpoint calls to the handleControlCommands function.// Control commands if (["setBreakpoint", "removeBreakpoint", "continue", "next", "step", "stepout", "variables", "evaluate"].includes(name)) { return handleControlCommands(name, args); }