# call()

Canonical URL: https://developers.iagenify.com/sdk/ref/mcp-client/call/
Language: en

`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.

Status: 60 s · 60 000 characters · schema carries headers

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

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `name` | string | required | The tool, as the server names it — not the prefixed name. |
| `args` | object | {} | Its arguments. |
| `signal` | AbortSignal |  | Cancels it. |
| `timeout` | integer | 60 000 | Milliseconds. |
| `schema` | object |  | The tool's recorded schema, so header annotations can be honoured. |

## Pass the schema when the tool uses headers {#schema}

> **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 {#clipping}

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 {#errors}

| Code | Status | When |
| --- | --- | --- |
| mcp_error | 502 | The server returned a protocol error. Its message is carried. |
| mcp_http_error | 502 | A refusal at the HTTP level. |
| mcp_bad_response | 502 | The answer was not a readable protocol message. |
| mcp_timeout | 504 | Past the timeout. |
| mcp_unauthorized | 401 | The token was refused. |

## In an agent, this is wrapped {#agents}

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.

- [api.mcp.call()](/sdk/ref/mcp/call): The same, with the connection read for you.
- [Errors](/sdk/mcp/errors): What each code means.

```python
output = client.call("search_docs", {"query": "retry policy"})
```
