Summary
Claude agent intermittently narrates intent to call GenerateReport in text but ends its turn without actually invoking the tool function. The user sees a truncated response like "Let me fetch your food data... Got all 7 days! Now let me generate your report!" followed by nothing.
Evidence
Log Analytics query on 2026-04-20 at 10:54 UTC:
get_food_by_date_range MCP tool called successfully at 10:54:21 — returned 7 days of food data
- Second Anthropic API call at 10:54:47 returned 200 (1244ms) — Claude responded with text only, no tool call
GenerateReport was never invoked — no log entry after the food data call
POST / AGUI request completed with 200 in 76.9 seconds — no timeout, no error
- The
GenerateReport function is correctly registered and was successfully called earlier the same day at 09:41 UTC
Root Cause (Suspected)
Claude is consuming most of its output token budget on the text narration ("Let me fetch... Got the data... Now let me generate...") and the large food data tool result in the conversation context, leaving insufficient tokens to emit the GenerateReport tool call JSON. The agent ends its turn with end_turn stop reason instead of tool_use.
Impact
- Users cannot generate diet analysis or food-related reports when the food data payload is large (7 days × detailed nutrition records)
- The issue is intermittent —
GenerateReport worked at 09:41 UTC the same day
Potential Fixes
- Reduce food data payload size — paginate or summarize before passing to
GenerateReport
- Increase
max_tokens on the Anthropic API call for the main chat agent
- Adjust system prompt to discourage narration of tool calls (instruct the agent to call tools directly without announcing)
- Split the flow — have the agent call
GenerateReport in a separate turn after receiving food data
Summary
Claude agent intermittently narrates intent to call
GenerateReportin text but ends its turn without actually invoking the tool function. The user sees a truncated response like "Let me fetch your food data... Got all 7 days! Now let me generate your report!" followed by nothing.Evidence
Log Analytics query on 2026-04-20 at 10:54 UTC:
get_food_by_date_rangeMCP tool called successfully at 10:54:21 — returned 7 days of food dataGenerateReportwas never invoked — no log entry after the food data callPOST /AGUI request completed with 200 in 76.9 seconds — no timeout, no errorGenerateReportfunction is correctly registered and was successfully called earlier the same day at 09:41 UTCRoot Cause (Suspected)
Claude is consuming most of its output token budget on the text narration ("Let me fetch... Got the data... Now let me generate...") and the large food data tool result in the conversation context, leaving insufficient tokens to emit the
GenerateReporttool call JSON. The agent ends its turn withend_turnstop reason instead oftool_use.Impact
GenerateReportworked at 09:41 UTC the same dayPotential Fixes
GenerateReportmax_tokenson the Anthropic API call for the main chat agentGenerateReportin a separate turn after receiving food data