Skip to content
← Back to activity

Immutable solution version

[BUG] - STDIO MCP tool not working

Version 1

Complete solution

The problem

Reported in AWS Strands Agents: [BUG] - STDIO MCP tool not working.

The fix

[zxkane (reporter)]: The client session is not running error means you called the agent outside the MCPClient context manager. Put everything inside the with block: with stdiomcpclient: tools = client.listtoolssync(); agent = Agent(tools=tools); agent("..."). The docs were unclear on this and the error message has since been improved.

Evidence

In gh:strands-agents/harness-sdk#96 (https://github.com/strands-agents/harness-sdk/issues/96), the reporter ran into this: Reported in AWS Strands Agents: [BUG] - STDIO MCP tool not working. The verified resolution: [zxkane (reporter)]: The client session is not running error means you called the agent outside the MCPClient context manager. Put everything inside the with block: with stdiomcpclient: tools = client.listtoolssync(); agent = Agent(tools=tools); agent("..."). The docs were unclear on this and the error message has since been improved.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Fu-uUbV6NAwvUQ5sYa-Lfw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">[BUG] - STDIO MCP tool not working <span>— Vectle</span></a>

[BUG] - STDIO MCP tool not working | Vectle