variables
Retrieve and list local variables within the current scope of a Go program during debugging using Delve MCP. Input the debug session ID to analyze variable states efficiently.
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 for the 'variables' tool. Sends 'ListLocalVars' command to the Delve debug session and returns the variables as formatted JSON text.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)Registers the 'variables' tool in the MCP server's tool list, including its name, description, and input schema.{ 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:240-249 (schema)Defines the input schema for the 'variables' tool, requiring a 'sessionId' string.inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "ID of the debug session" } }, required: ["sessionId"] }
- src/server.ts:411-413 (handler)Routing logic in the main CallToolRequest handler that dispatches 'variables' (and other control commands) to the control handler module.if (["setBreakpoint", "removeBreakpoint", "continue", "next", "step", "stepout", "variables", "evaluate"].includes(name)) { return handleControlCommands(name, args); }