evaluate
Evaluate expressions in Go debug sessions to inspect variables and test code behavior during debugging.
Instructions
Evaluate an expression in current scope
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | ID of the debug session | |
| expr | Yes | Expression to evaluate |
Implementation Reference
- src/handlers/control.ts:102-111 (handler)The core handler logic for the 'evaluate' tool. It extracts the expression from args, sends an 'Eval' command to the active Delve debug session, and returns the evaluated variable as JSON.case "evaluate": { const { expr } = args; const response = await sendDelveCommand(session, "Eval", { expr }); return { content: [{ type: "text", text: JSON.stringify(response.Variable, null, 2) }] }; }
- src/server.ts:252-268 (registration)Registers the 'evaluate' tool in the ListToolsRequestHandler, providing its name, description, and input schema definition.name: "evaluate", description: "Evaluate an expression in current scope", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "ID of the debug session" }, expr: { type: "string", description: "Expression to evaluate" } }, required: ["sessionId", "expr"] } },
- src/server.ts:411-412 (registration)In the CallToolRequestHandler, dispatches calls to the 'evaluate' tool to the handleControlCommands function in control.ts.if (["setBreakpoint", "removeBreakpoint", "continue", "next", "step", "stepout", "variables", "evaluate"].includes(name)) { return handleControlCommands(name, args);
- src/server.ts:254-267 (schema)Defines the input schema for the 'evaluate' tool, requiring sessionId and expr parameters.inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "ID of the debug session" }, expr: { type: "string", description: "Expression to evaluate" } }, required: ["sessionId", "expr"] }