MCP: get_stdio_tools() fails in documented setup
维护者通常 2 天内回复
评估
调研方向
Start with get_stdio_tools() and its connection helper, then compare the lifecycle used by get_http_tools(). Re-run the documented uv command on the frozen revision and verify that discovery starts the MCP transport and returns tools without requiring agent.run().
由索引模型根据 Issue 内容生成。
描述
Bug description
The MCP reference shows calling get_stdio_tools() as setup code that returns AgentTool values to pass to ai.Agent. On the frozen main revision, the documented call raises before returning tools when run outside agent.run().
Reproduction
From the repository root with Python 3.12:
uv run --frozen --python 3.12 python -c 'import asyncio, ai; asyncio.run(ai.mcp.get_stdio_tools("python", "--version"))'
Observed error:
RuntimeError: MCP tools must be used inside agent.run(). The connection pool is not initialized.
The pool check happens before an MCP transport is started, so this call does not launch the subprocess.
Expected behavior
The documented setup call should return tools that can be passed to ai.Agent, or the reference should show a supported lifecycle for discovery.
Source context
get_stdio_tools() calls the connection helper without establishing the pool. get_http_tools() establishes the pool around discovery. This is reproducible against main at c788059dd1db2d93ae1c3da6daffb660eca07dbb.
- 主要语言
- Python
- 星标
- 189
- 派生
- 26
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 14
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vercel-labs/ai-python 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
vercel-labs/ai-python#299 ·
维护者通常 2 天内回复
-
Structured output streaming: no way to see the object while it generates可能已有人在做 @jaygupta17 于 43 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 55/100
vercel-labs/ai-python#272 ·
维护者通常 2 天内回复
-
Tool parameters lose descriptions from Annotated[...] and docstring Args sections可能已有人在做 @jaygupta17 于 43 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 72/100
vercel-labs/ai-python#270 ·
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
vercel-labs/ai-python#224 · 1 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
查看 vercel-labs/ai-python 的全部 Issue
相似的 Issue
-
Maven path-index: "Ambiguous or noncanonical artifact path" error does not report the offending path未关闭
难度 2/5 1-3 小时 新手友好度 76/100
pulp/pulp_maven#524 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 3 天内回复
-
难度 1/5 1-3 小时 新手友好度 88/100
infinispan/langchain-infinispan#34 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
521xueweihan/HelloGitHub#3891 ·