# geni mcp call

> Call one MCP tool from a JSON request and print one line of JSON.

Source: https://docs.generalinput.com/cli/mcp/call



```sh
geni mcp call [request.json]
```

Reads the request from the file, or from stdin when none is named, and calls the tool. It reads the same request as the sandbox's `mcp-call`. Run it inside [`geni exec bash`](/cli/exec/bash) with the connection declared: that sets its token in the env var the request names, and the local proxy decides the tool against the Agent Firewall.

```sh
geni exec bash --cred cred_01HX9MC --reason "Listing my open Linear issues" --file - <<'EOF'
geni mcp call <<'JSON'
{"url":"https://mcp.linear.app/mcp","auth":{"kind":"bearer","tokenEnv":"MCP_LINEAR_ACCESS_TOKEN_01HX9MC"},"toolName":"list_issues","arguments":{},"outputDir":"work/mcp-results/list_issues","stallTimeoutMs":60000,"totalTimeoutMs":300000}
JSON
EOF
```

`geni integration operation <server>.<tool>` prints this command filled in for each of your connections; fill `arguments` from the tool's schema.

## Request [#request]

| Field            | Notes                                                                                                |
| ---------------- | ---------------------------------------------------------------------------------------------------- |
| `url`            | The server's URL.                                                                                    |
| `auth`           | `{"kind":"bearer","tokenEnv":…}`, `{"kind":"header","header":…,"tokenEnv":…}`, or `{"kind":"none"}`. |
| `toolName`       | The tool.                                                                                            |
| `arguments`      | The tool's arguments, as its schema describes them.                                                  |
| `outputDir`      | Where images, files and long text are saved.                                                         |
| `stallTimeoutMs` | How long the call may go without progress.                                                           |
| `totalTimeoutMs` | How long it may take in all.                                                                         |

## Output [#output]

One line of JSON, and an exit code that says how it went (see [Exit codes](#exit-codes)).

* `ok: true`: `isError`, `content` (text inline; images, files and long text saved under `outputDir`, each named by its `path`) and `structuredContent`.
* `ok: false`: `kind` (`unauthorized`, `insufficient_scope`, `timeout`, `tool_changed`, `bad_request`, …), `message`, and `isFirewallRefusal` when the Agent Firewall refused the tool.

Under `geni exec`, geni needs Node 22.21 or later in 22.x, or Node 24 or later, whose fetch goes through the local proxy; on any other Node (23.x included) the call is refused rather than made around it.

## Exit codes [#exit-codes]

| Code | Meaning                                                                         |
| ---- | ------------------------------------------------------------------------------- |
| `0`  | The tool ran and succeeded.                                                     |
| `1`  | The call couldn't complete (`ok: false`: sign-in, timeout, the server's error). |
| `2`  | The request is wrong (`bad_request`).                                           |
| `3`  | The tool answered with an error (`isError`). This command's own code.           |
| `5`  | The Agent Firewall refused the tool.                                            |
