Fix server_tool_use input_json_delta handling and improve Anthropic samples

- Fix: Skip input_json_delta for server_tool_use content blocks in AnthropicClient streaming. Server-managed tools (e.g., skills with code interpreter) were producing Content.from_function_call(name='') entries that caused Anthropic API 400 errors on subsequent turns.

- Samples: Add dotenv loading and environment variable documentation to Anthropic Claude samples (MCP, permissions, session, shell, tools, URL, skills).
This commit is contained in:
Chetan Toshniwal
2026-04-01 20:35:58 -07:00
Unverified
parent 95550dd0dc
commit a59e048d71
8 changed files with 44 additions and 2 deletions
@@ -1271,8 +1271,8 @@ class RawAnthropicClient(
)
)
case "input_json_delta":
# Skip argument deltas for MCP tools — execution is handled server-side.
if self._last_call_content_type == "mcp_tool_use":
# Skip argument deltas for MCP and server tools — execution is handled server-side.
if self._last_call_content_type in ("mcp_tool_use", "server_tool_use"):
pass
else:
call_id = self._last_call_id_name[0] if self._last_call_id_name else ""