Kiro Gateway Version
Current main at a5292ca (v2.4 development branch)
What happened?
When the Anthropic compatibility route auto-injects and intercepts the emulated web_search tool (Path B), the gateway executes the Kiro MCP search and emits Anthropic-compatible server_tool_use and web_search_tool_result blocks. It then appends a literal <web_search>...</web_search> summary as assistant text and ends the turn.
This differs from Anthropic server-tool behavior. The model never receives the search result, so it cannot synthesize an answer or continue the user's original task after deciding to search. Claude Code consequently displays the raw search dump as the assistant response.
Expected behavior:
- emit the server-tool blocks to the client;
- append the model's original
web_search tool call and matching result to an internal conversation history;
- continue the same model internally;
- stream the model's natural answer or subsequent client-tool calls in the original Anthropic SSE message.
Internal continuation should be bounded to prevent search loops, preserve ordinary client tool calls, and fall back to the deterministic search summary if continuation fails.
Debug Logs
Sanitized behavior before the fix:
Intercepted web_search tool call (Path B - MCP emulation)
content blocks: server_tool_use, web_search_tool_result, text
assistant text: <web_search>...</web_search>
stop_reason: end_turn
No prompts, search queries, results, credentials, account identifiers, profile ARN values, local paths, or raw debug files are included.
Kiro Gateway Version
Current
mainata5292ca(v2.4 development branch)What happened?
When the Anthropic compatibility route auto-injects and intercepts the emulated
web_searchtool (Path B), the gateway executes the Kiro MCP search and emits Anthropic-compatibleserver_tool_useandweb_search_tool_resultblocks. It then appends a literal<web_search>...</web_search>summary as assistant text and ends the turn.This differs from Anthropic server-tool behavior. The model never receives the search result, so it cannot synthesize an answer or continue the user's original task after deciding to search. Claude Code consequently displays the raw search dump as the assistant response.
Expected behavior:
web_searchtool call and matching result to an internal conversation history;Internal continuation should be bounded to prevent search loops, preserve ordinary client tool calls, and fall back to the deterministic search summary if continuation fails.
Debug Logs
Sanitized behavior before the fix:
No prompts, search queries, results, credentials, account identifiers, profile ARN values, local paths, or raw debug files are included.