Skip to content

fix: change client_tool_result.result from Map to String#37

Merged
shiragannavar merged 1 commit intomainfrom
fix/client-tool-result-string-type
Dec 16, 2025
Merged

fix: change client_tool_result.result from Map to String#37
shiragannavar merged 1 commit intomainfrom
fix/client-tool-result-string-type

Conversation

@shiragannavar
Copy link
Copy Markdown
Collaborator

The backend expects client_tool_result.result as a string, not a JSON object. This was causing 'policy violation' errors when client tools returned results.

Changes:

  • ConversationEventParser.kt: Change ClientToolResult.result type from Map<String, Any> to String
  • ConversationEventHandler.kt: Send result as string directly, not wrapped in a map
  • ConversationSession.kt: Update interface signature for sendToolResult()
  • ConversationSessionImpl.kt: Update implementation signature
  • DynamicClientToolTest.kt: Update tests to use string results
  • README.md: Update documentation examples

Note: Users can still send complex data by serializing to JSON string (e.g., Gson().toJson(myObject)).

The backend expects client_tool_result.result as a string, not a JSON object.
This was causing 'policy violation' errors when client tools returned results.

Changes:
- ConversationEventParser.kt: Change ClientToolResult.result type from Map<String, Any> to String
- ConversationEventHandler.kt: Send result as string directly, not wrapped in a map
- ConversationSession.kt: Update interface signature for sendToolResult()
- ConversationSessionImpl.kt: Update implementation signature
- DynamicClientToolTest.kt: Update tests to use string results
- README.md: Update documentation examples

Note: Users can still send complex data by serializing to JSON string
(e.g., Gson().toJson(myObject)).

/**
* Tool result event
* Note: result must be a String (plain text or JSON string), not a Map/Object.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this comment.

@shiragannavar shiragannavar merged commit d3f8430 into main Dec 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants