Skip to content

Conversation

@daniel-lxs
Copy link
Member

Problem

When using LiteLLM with Bedrock as the provider, conversation condensing fails with error:

400 litellm.UnsupportedParamsError: Bedrock doesn't support tool calling without tools= param specified

This occurs because conversation history contains tool_use and tool_result blocks, but during condensing no tools parameter is passed to the API call.

Solution

Transform tool blocks to text representations before sending for summarization. This removes the structural dependency on the tools parameter while preserving semantic meaning for the LLM to summarize.

Changes

  • Added toolUseToText() - converts tool_use blocks to readable text format
  • Added toolResultToText() - converts tool_result blocks to readable text format
  • Added convertToolBlocksToText() - processes content arrays
  • Added transformMessagesForCondensing() - applies transformation to message arrays
  • Applied transformation in summarizeConversation() before API call
  • Added 18 unit tests for the new functions

Example Transformation

Before (tool_use block):

{
  "type": "tool_use",
  "id": "toolu_123",
  "name": "read_file",
  "input": { "path": "src/index.ts" }
}

After (text block):

{
  "type": "text",
  "text": "[Tool Use: read_file]\npath: src/index.ts"
}

Linear Issue

https://linear.app/roocode/issue/EXT-624

…atibility

- Add toolUseToText() to convert tool_use blocks to text format
- Add toolResultToText() to convert tool_result blocks to text format
- Add convertToolBlocksToText() to transform all tool blocks in message content
- Add transformMessagesForCondensing() to apply transformation to messages
- Apply transformation in summarizeConversation() before API call
- Add 18 unit tests for full coverage

Fixes LiteLLM/Bedrock error: 'Bedrock doesn't support tool calling without tools= param specified'

When condensing conversations containing tool_use/tool_result blocks, Bedrock requires the tools parameter. By transforming these blocks to text representations, we remove this dependency while preserving semantic meaning for summarization.
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners January 26, 2026 16:24
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jan 26, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 26, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues identified.

The implementation correctly transforms tool_use and tool_result blocks to text representations before sending for summarization, resolving the Bedrock/LiteLLM compatibility issue. The code is well-structured with comprehensive test coverage (18 new tests).

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

2 participants