A React Native app for the ultimate thinking partner.

Fix tool call arguments not showing for streamed messages

The issue: streaming stores arguments as JSON string, but parseToolCall
expected an object. Added JSON.parse when arguments is a string.

Now tool calls display properly for both:
- Historical messages (already formatted)
- Streaming messages (JSON string → parsed → formatted)

🐾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>

+20 -2
+11 -1
src/hooks/useMessageGroups.ts
··· 533 533 const toolCall = msg.tool_call || msg.tool_calls![0]; 534 534 const callObj: any = toolCall.function || toolCall; 535 535 const name = callObj?.name || 'unknown_tool'; 536 - const args = callObj?.arguments || callObj?.args || {}; 536 + let args = callObj?.arguments || callObj?.args || {}; 537 + 538 + // If args is a JSON string, parse it first 539 + if (typeof args === 'string') { 540 + try { 541 + args = JSON.parse(args); 542 + } catch (e) { 543 + // If parse fails, keep as string 544 + console.warn('Failed to parse tool arguments:', args); 545 + } 546 + } 537 547 538 548 // Format as Python call 539 549 const formatArgsPython = (obj: any): string => {
+9 -1
src/hooks/useMessageStream.ts
··· 50 50 const toolCall = (chunk as any).toolCall || (chunk as any).tool_call; 51 51 if (toolCall) { 52 52 const toolName = toolCall.name || toolCall.tool_name || 'unknown'; 53 - const args = toolCall.arguments || ''; 53 + // Try multiple places for arguments 54 + let args = toolCall.arguments || toolCall.args || ''; 55 + 56 + // If args is an object, format it as a string 57 + if (typeof args === 'object' && args !== null) { 58 + args = JSON.stringify(args); 59 + } 60 + 61 + console.log('🔧 Tool call:', toolName, 'args:', args); 54 62 chatStore.accumulateToolCall(chunkId, toolName, args); 55 63 } 56 64 }