---
title: McpCallOutput
description: "The output of an `mcp.call` Effect: what the `onDone` of its state gets as `event.output`."
---

# `McpCallOutput`

Type, in `@jr2/orchestrator/src/effector-wire.ts`. It is an export of `@jr2/orchestrator`, in the [Effects](group-effects.md) group of the [Authoring surface](../authoring-surface.md) page.

```ts
type McpCallOutput =
  | { outcome: "returned"; isError: boolean; text: string; structured?: unknown; truncated?: boolean }
  | McpNotReturned;
```

The output of an `mcp.call` Effect: what the `onDone` of its state gets as `event.output`. Every
outcome is output. Route on `outcome`:

- `returned`: the server answered the call. `isError` is the tool's own `isError`: the tool ran
  and says that it failed. `text` joins the text of the result's content; a part that is not text
  is one line that names its type. `structured` is the result's `structuredContent`, when it has
  one. `text` and `structured` each have the byte bound of the Effect's `maxBody`: past it, jr2
  cuts `text`, drops `structured`, and sets `truncated`.
- `refused`: the request did not run. The server answered an HTTP 3xx or 4xx status (a 401 or a
  403 included) at any step, the handshake too; it refused the handshake; or it answered the
  request with the JSON-RPC error `-32700`, `-32600`, `-32601` or `-32602`: a request that it
  could not read, an unknown method, an unknown tool, or bad arguments; or it answered a read with
  `-32002`: the resource does not exist. It is also the Effector's
  own refusal, with nothing sent: the server or its secret is not in its `effector.json`.
- `unreachable`: nothing of the request was sent: the name did not resolve, or the connection,
  TLS or the handshake failed otherwise (a 5xx, the timeout, an answer that is not MCP's, a
  revision of MCP that jr2 does not speak).
- `input-required`: the server asked for input, which jr2 does not give. After the error
  `-32042`, the tool did not run. After an `elicitation/create` request, which comes while the
  tool runs, the tool may have begun. jr2 does not send the request again: a Machine that
  invokes the Effect again after a Gate can run a part of the tool two times.
- `unknown`: the request was sent and no answer came (the timeout, a reset, a stream that ended
  first), or the server answered with a 5xx or another JSON-RPC error. The tool may have acted.
  jr2 does not send it again unless it is marked `idempotent`.

jr2 replaces each value of an Effect secret that the Effector holds with `[secret:<name>]`, in
every string of the output. The union is open ([`LaterOutcome`](type-lateroutcome.md)): give the rest a last arm
with no guard.

**Forms**: it is one of these objects.

- Form 1: `outcome`, `isError`, `text`, `structured`, `truncated`

  - `outcome`: `"returned"`
  - `isError`: `boolean`
  - `text`: `string`
  - `structured` (optional): `unknown`
  - `truncated` (optional): `boolean`
- Form 2: `outcome`, `reason`

  - `outcome`: `"refused"`
  - `reason`: `string`
- Form 3: `outcome`, `reason`

  - `outcome`: `"unreachable"`
  - `reason`: `string`
- Form 4: `outcome`, `reason`

  - `outcome`: `"input-required"`
  - `reason`: `string`
- Form 5: `outcome`, `reason`

  - `outcome`: `"unknown"`
  - `reason`: `string`
- Form 6: `outcome`, `reason`

  - `outcome`: `"(a later outcome)"`
  - `reason` (optional): `string`

**See also**

- [Effects](../../concepts/effects.md)
- [ADR-0079: An Agent holds MCP tools, a Machine calls them as an Effect, and the Machine is the approval](../decisions/0079-an-agent-holds-mcp-tools-a-machine-calls-them-as-an-effect-and-the-machine-is-the-approval.md)
