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)namestringrequiredThe server.
toolstringrequiredThe tool, as the server names it.
argsobject{}Its arguments.
signalAbortSignalCancels the call.
What it does
Reads the connection, shakes hands, and calls the tool — carrying the header annotations the server's own schema asked for. The result is the server's output, clipped at 60 000 characters with a note saying how much was left out.
There is no permission callback here
The category decides what an agent is asked about; calling it yourself bypasses that entirely, because you are the one deciding. Do not route a model's choice through this — give the model the tool through an agent, where the category applies.
It is not bound by the allowed list
The allowed list decides what is declared to a model. Calling a tool yourself is a decision you have already made — which is what makes this useful for checking a tool before allowing it.
Sixty seconds
A call has a 60-second ceiling, and listing tools 30. A server that goes quiet raises mcp_timeout rather than holding a run open.
Writing your own loop
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