api.mcp

forAgent()

api.mcp.forAgent(names?) → Promise<Server[]>

引擎已准备就绪的服务器: 允许的工具和标记。 这是 agents.create({ mcp }) 读物——你很少自己称呼它。

tokens includednull means all[] means none
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

await api.mcp.forAgent();            // every connected server
await api.mcp.forAgent(["example"]); // these
await api.mcp.forAgent([]);          // none — and no request is made
api.mcp.for_agent()              # every connected server
api.mcp.for_agent(["example"])   # these
api.mcp.for_agent([])            # none — and no request is made

和[]是不同的,两者都有用

通过含义
null 或无每个连接服务器
["a", "b"]这两人
[]毫无保留,它立即返回,没有问。
保持警戒

只有允许的工具才能出来, 所以每个服务器都取走不是它听起来像打开的门。 一个没有允许的服务器不会贡献任何东西 。

带有标志

引擎需要他们联系每个服务器, 所以这是包括它们在内的列表。 他们被解密给认证的所有人, 其他人也不要—— 不要记录返回的内容 。

探员给你读了

api.agents.create({ runtime: "local", machine: pc, model, mcp: ["example"] });
// mcp absent  → every connected server
// mcp: []     → none
api.agents.create(runtime="local", machine=pc, model=model, mcp=["example"])
# mcp absent → every connected server
# mcp=[]     → none

每次运行开始时都会重新读取, 因此从另一个窗口连接到服务器, 无需重新启动软件包的维持 。

何时直接呼叫

当你在制造引擎的工具时 使自己塑造自己 createMcpTools() 精确地取回返回的 。 单是声明, () 工具 是使用该工具的。