McpClient

call()

client.call(name, args, { signal?, timeout?, schema? }) → Promise<string>

Runs one tool and returns its output as text, clipped at 60 000 characters with a note saying how much was left out.

60 s60 000 charactersschema carries headers
Using Python?

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

const output = await client.call("search_docs", { query: "retry policy" });
output = client.call("search_docs", {"query": "retry policy"})
namestringrequired

The tool, as the server names it — not the prefixed name.

argsobject{}

Its arguments.

signalAbortSignal

Cancels it.

timeoutinteger60 000

Milliseconds.

schemaobject

The tool's recorded schema, so header annotations can be honoured.

Pass the schema when the tool uses headers

Without it, an annotated argument stays in the body

A server that expects it in a header then sees a mismatch between the header and the body, and refuses with a protocol-level error. api.mcp.call() passes the recorded schema for exactly this reason.

Long output is clipped, and says so

At 60 000 characters, with a line stating how many were dropped. A tool returning a whole dataset would otherwise fill a model's context in one call.

Errors

CodeStatusWhen
mcp_error502The server returned a protocol error. Its message is carried.
mcp_http_error502A refusal at the HTTP level.
mcp_bad_response502The answer was not a readable protocol message.
mcp_timeout504Past the timeout.
mcp_unauthorized401The token was refused.

In an agent, this is wrapped

The engine turns each allowed tool into an ordinary tool with a category, so a call goes through the permission callback and counts in the run. Calling the client directly skips all of that — which is correct when the decision is yours.