Skip to content

Python: [Bug]: Claw step 3 sample fails to connect to Foundry Toolbox with mcp 2.x #9594

Description

Description

python/samples/02-agents/harness/build_your_own_claw/claw_step03_scaling_capabilities.py cannot connect to a Foundry Toolbox since the MCP 2.x migration (#9236). When FOUNDRY_TOOLBOX_ENDPOINT is set, _connect_foundry_toolbox() fails before the agent starts:

ValueError: not enough values to unpack (expected 3, got 2)

In mcp 2.x, mcp.client.streamable_http.streamable_http_client yields TransportStreams, which is (read_stream, write_stream). The sample still unpacks the 1.x three-tuple:

read, write, _ = await stack.enter_async_context(streamable_http_client(url=url, http_client=http_client))

The sample also builds the client with httpx.AsyncClient, while mcp 2.x types http_client as httpx2.AsyncClient. The declarative invoke_foundry_toolbox_mcp sample was already moved to import httpx2 as httpx for this reason.

harness is in SAMPLE_TYPING_EXCLUDES, so the samples type-check sweep does not catch it. Pyright on the file reports both problems (Tuple size mismatch; expected 3 but received 2 and "httpx._client.AsyncClient" is not assignable to "httpx2._client.AsyncClient").

Reproduction

I ran the sample's own _connect_foundry_toolbox() against a local mcp 2.3.0 MCPServer served over streamable HTTP, with the token provider stubbed:

result
main ValueError: not enough values to unpack (expected 3, got 2)
unpack two values + httpx2 client session initializes, list_tools() returns the server's tools

Expected behavior

Step 3 connects to the Foundry Toolbox MCP endpoint and loads its skills.

Proposed fix

Unpack read, write = ..., and import httpx2 as httpx (with the PEP 723 dependency changed from httpx to httpx2), matching the declarative toolbox sample. I have a PR ready.

Package Versions

agent-framework-core from main at 8be57da, mcp 2.3.0.

Python Version

3.13

AI Assistance

Claude Code helped find the breakage (by type-checking excluded samples), build the local MCP server reproduction, and draft this report. I verified the reproduction locally.

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 22, 2026
  2. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Oct 22, 2026
  3. github-actions commented on Oct 22, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    The bug is in python/samples/02-agents/harness/build_your_own_claw/claw_step03_scaling_capabilities.py::_connect_foundry_toolbox at line 228, where enabling FOUNDRY_TOOLBOX_MCP_SERVER_URL causes a three-value unpack of MCP 2.x’s two-value transport streams. Minimal repro: invoke _connect_foundry_toolbox() with MCP 2.3.0 or an async transport context yielding (read_stream, write_stream) and observe the ValueError before ClientSession construction.

    • Failing test: python/tests/samples/harness/test_claw_step03_foundry_toolbox.py
    • Files examined: python/samples/02-agents/harness/build_your_own_claw/claw_step03_scaling_capabilities.py, python/samples/03-workflows/declarative/invoke_foundry_toolbox_mcp/main.py, python/scripts/workspace_poe_tasks.py, python/AGENTS.md
    • Tests run: python/tests/samples/harness/test_claw_step03_foundry_toolbox.py
    • Reported version: mcp 2.3.0
  4. removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions