evaluate
Evaluate expressions in the current scope during debugging sessions with Delve MCP. Input session ID and expression to analyze and debug Go code efficiently.
Instructions
Evaluate an expression in current scope
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes | Expression to evaluate | |
| sessionId | Yes | ID of the debug session |
Implementation Reference
- src/handlers/control.ts:102-111 (handler)Executes the 'evaluate' tool by sending an 'Eval' command to the Delve debug session with the provided expression and returns the result as formatted 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:254-268 (schema)Defines the input schema for the 'evaluate' tool, specifying required '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"] } },
- src/server.ts:251-269 (registration)Registers the 'evaluate' tool in the ListTools response, providing name, description, and input schema.{ 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"] } }, // Advanced debug tools
- src/server.ts:410-413 (registration)Registers the dispatch for 'evaluate' tool in the CallToolRequest handler, routing to handleControlCommands.// Control commands if (["setBreakpoint", "removeBreakpoint", "continue", "next", "step", "stepout", "variables", "evaluate"].includes(name)) { return handleControlCommands(name, args); }