setBackend
Set the debugging backend to default, native, lldb, or rr for Go program debugging via Delve.
Instructions
Set the backend for debugging
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| backend | Yes | Backend to use (default, native, lldb, or rr) |
Implementation Reference
- src/handlers/config.ts:11-24 (handler)The handler implementation for 'setBackend': validates the backend argument (must be one of 'default', 'native', 'lldb', 'rr'), sets the DELVE_BACKEND environment variable, and returns a success message.
case "setBackend": { const { backend } = args; if (!["default", "native", "lldb", "rr"].includes(backend)) { throw new Error("Invalid backend specified"); } process.env.DELVE_BACKEND = backend; return { content: [{ type: "text", text: `Set Delve backend to ${backend}` }] }; } - src/server.ts:349-397 (registration)The tool registration in ListToolsRequestSchema: defines name 'setBackend', description, and inputSchema with a 'backend' enum property (required).
// Configuration tools { name: "version", description: "Get Delve version information", inputSchema: { type: "object", properties: {} } }, { name: "setBackend", description: "Set the backend for debugging", inputSchema: { type: "object", properties: { backend: { type: "string", description: "Backend to use (default, native, lldb, or rr)", enum: ["default", "native", "lldb", "rr"] } }, required: ["backend"] } }, { name: "configureLogging", description: "Configure debug logging", inputSchema: { type: "object", properties: { components: { type: "array", items: { type: "string", enum: ["debugger", "gdbwire", "lldbout", "debuglineerr", "rpc", "dap", "fncall", "minidump", "stack"] }, description: "Components to enable logging for" }, destination: { type: "string", description: "Log destination (file path or file descriptor)" } }, required: ["components"] } } ] }; }); - src/server.ts:402-421 (registration)The CallToolRequestSchema dispatcher: routes 'setBackend' calls to handleConfigCommands handler.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; // Debug commands if (["debug", "attach", "exec", "test", "core", "dap", "replay", "trace"].includes(name)) { return handleDebugCommands(name, args); } // Control commands if (["setBreakpoint", "removeBreakpoint", "continue", "next", "step", "stepout", "variables", "evaluate"].includes(name)) { return handleControlCommands(name, args); } // Configuration commands if (["setBackend", "configureLogging", "version"].includes(name)) { return handleConfigCommands(name, args); } throw new Error("Unknown tool"); }); - src/types.ts:16-25 (helper)The DebugSession interface includes an optional 'backend' field, which is set via the setBackend tool.
export interface DebugSession { id: string; type: string; // 'debug' | 'attach' | 'exec' | 'test' | 'core' | 'replay' | 'trace' | 'dap' target: string; process?: ChildProcess; port: number; breakpoints: Map<number, Breakpoint>; logOutput?: string[]; backend?: string; }