variables
List local variables in the current scope during Go program debugging to inspect program state and identify issues.
Instructions
List local variables in current scope
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | ID of the debug session |
Implementation Reference
- src/handlers/control.ts:92-100 (handler)The core handler logic for the 'variables' tool. It sends a 'ListLocalVars' command to the Delve debugger session and returns the local variables as a formatted JSON string.case "variables": { const response = await sendDelveCommand(session, "ListLocalVars", {}); return { content: [{ type: "text", text: JSON.stringify(response.Variables, null, 2) }] }; }
- src/server.ts:237-250 (registration)Registration of the 'variables' tool in the MCP server's tool list, including name, description, and input schema requiring a sessionId.{ name: "variables", description: "List local variables in current scope", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "ID of the debug session" } }, required: ["sessionId"] } },
- src/server.ts:410-413 (registration)Dispatch/registration routing for control commands including 'variables', which delegates to handleControlCommands.// Control commands if (["setBreakpoint", "removeBreakpoint", "continue", "next", "step", "stepout", "variables", "evaluate"].includes(name)) { return handleControlCommands(name, args); }