Repository navigation
Python: Fix claw step 3 Foundry Toolbox connection for mcp 2.x - #9597
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Conversation
mcp 2.x's streamable_http_client yields (read, write) instead of (read, write, get_session_id), so the three-way unpack raised ValueError whenever FOUNDRY_TOOLBOX_ENDPOINT was set. Also build the client with httpx2, which is the type mcp 2.x accepts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
deployed
to
github-app-auth
October 22, 2026 12:54 — with
GitHub Actions
Active
Naveen Chatlapalli (1aifanatic)
deployed
to
github-app-auth
October 22, 2026 12:54 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrow sample-only changes address the reported compatibility failure consistently, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Fixes the step 3 “build your own claw” sample’s Foundry Toolbox connection after the MCP 2.x migration, addressing #9594.
Changes:
- Updates the inline dependency and HTTP client import to
httpx2. - Unpacks the two transport streams returned by MCP 2.x, leaving authentication and session lifecycle unchanged.
| File | Description |
|---|---|
python/samples/02-agents/harness/build_your_own_claw/claw_step03_scaling_capabilities.py |
Aligns the HTTP client and transport unpacking with MCP 2.x. |
Review effort: Balanced
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
Since the MCP 2.x migration (#9236), step 3 of the "build your own claw" harness sample cannot connect to a Foundry Toolbox.
_connect_foundry_toolbox()unpacks three values fromstreamable_http_client, but mcp 2.x yields(read, write), so it fails withValueError: not enough values to unpack (expected 3, got 2)wheneverFOUNDRY_TOOLBOX_ENDPOINTis set. Details in #9594.Description & Review Guide
read, write = await stack.enter_async_context(streamable_http_client(...)).import httpx2 as httpx, and the PEP 723 dependencyhttpxbecomeshttpx2. mcp 2.x typeshttp_clientashttpx2.AsyncClient, and the declarativeinvoke_foundry_toolbox_mcpsample already uses this import.httpx2keeps theAuth/AsyncClient/TimeoutAPI, so_ToolboxAuthis unchanged.Verified by running the sample's own
_connect_foundry_toolbox()against a local mcp 2.3.0MCPServerover streamable HTTP, with the bearer-token provider stubbed:mainValueError: not enough values to unpack (expected 3, got 2)list_tools()returns the server's toolPyright on the file goes from 2 errors to 0.
ruff checkandruff format --checkpass.Related Issue
Fixes #9594
AI Assistance
AI assistance details: Claude Code helped find the breakage, implement the fix, build the local MCP server verification, and draft this description and the linked issue.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code