api.mcp

call()

api.mcp.call(name, tool, args, { signal? }) → Promise<Result>

运行服务器工具之一, 不带代理器 , 检查连接, 或者因为您正在撰写自己的循环 。

no agent60 sno permission callback
Using Python?

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

const result = await api.mcp.call("example", "search_docs", { query: "retry policy" });
console.log(result);
result = api.mcp.call("example", "search_docs", {"query": "retry policy"})
print(result)
namestring必填

服务器

toolstring必填

服务器命名的工具 。

argsobject{}

其论点。

signalAbortSignal

取消电话

它可以做什么

读取连接、握手和拨打工具—— 携带服务器自己所要求图案的标题说明。 结果显示服务器输出, 剪切了6万个字符, 并写着有多少被遗漏。

这里没有回回回权限

这是你的决定,不是探员的

类别决定了代理被问到什么; 自己称它为完全绕过这个, 因为决定者是你。 不要通过这个选择选择模式, 给模型工具以代理, 并在此类别适用的地方 。

它不受允许清单的约束

允许的清单决定 向模型申报自己使用工具是您已经做出的决定,因此,在允许之前,这有利于检查工具。

60秒

电话有60秒上限,列出30个工具 静静升升升的服务器 mcp_timeout 而不是保持运行打开。

自己写自编环环

const tools = await api.mcp.tools(["example"]);
const turn = await api.models.turn({ model: "gemini-3.5-flash", messages, tools });

for (const call of turn.message.toolCalls ?? []) {
  const [server, tool] = splitYourWay(call.name);
  const output = await api.mcp.call(server, tool, call.args);
  // feed it back as a tool message
}
tools = api.mcp.tools(["example"])
turn = api.models.turn(model="gemini-3.5-flash", messages=messages, tools=tools)

for call in turn["message"].get("toolCalls") or []:
    server, tool = split_your_way(call["name"])
    output = api.mcp.call(server, tool, call["args"])
    # feed it back as a tool message