# MCP tools

> Parameters, results and example calls for the four Atracode MCP tools, plus how refusals and divergences come back.

> Preview: the commands, tools and API shapes on this page may change before launch.

Source: https://atracode.com/docs/mcp-tools

The [MCP server](/docs/mcp-server) gives your agent four tools. Each takes JSON arguments and returns a JSON result. This page lists the parameters and result shapes for the preview; names and fields may change before launch.

| Tool | What it does |
| --- | --- |
| `atracode_compile` | Compiles source to a SEG and returns its RAVEN hash, or a located refusal |
| `atracode_verify_equivalence` | Checks whether two programs, in any languages, have the same behavior |
| `atracode_inspect_seg` | Shows a compiled SEG's inputs, membrane reads and writes, and bounds |
| `atracode_get_raven_hash` | Returns a program's RAVEN hash only |

Every tool that takes code accepts either `source` (the program text) or `path` (a file the agent can read). Give one, not both. When you pass `source`, add `language` so the compiler knows which front end to use; with `path`, the language is inferred from the file name. Each call that compiles a program counts as one compilation against your workspace quota.

## atracode_compile

Compiles a program in any [supported language](/docs/languages).

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `source` | string | One of `source` or `path` | Program text |
| `path` | string | One of `source` or `path` | Path to a source file |
| `language` | string | No | Front end to use. Inferred from the file name when omitted |

Result:

| Field | Type | Description |
| --- | --- | --- |
| `status` | `"verified"` or `"refused"` | Outcome of the compile |
| `raven_hash` | string | 64 hex characters. Present when `status` is `"verified"` |
| `refusal` | object | `{ file, line, column, reason, hint }`. Present when `status` is `"refused"` |

Example call:

```json
{ "name": "atracode_compile", "arguments": { "path": "interest.py" } }
```

Verified result:

```json
{
  "status": "verified",
  "raven_hash": "13803fe6908d64b3301b931688e6244c99d9b80f15c781f5de7581abb7c3d2af"
}
```

Refused result:

```json
{
  "status": "refused",
  "refusal": {
    "file": "rotate.sh",
    "line": 12,
    "column": 9,
    "reason": "reads $(date), which differs on every run",
    "hint": "pass the timestamp in as an argument and compile again"
  }
}
```

## atracode_verify_equivalence

Compiles two programs and checks whether they compute the same thing. They can be in the same language or in different ones.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `a` | object | Yes | `{ source or path, language? }` for the first program |
| `b` | object | Yes | `{ source or path, language? }` for the second program |

Result:

| Field | Type | Description |
| --- | --- | --- |
| `identical` | boolean | `true` when both programs have the same behavior |
| `raven_a` | string | RAVEN hash of `a` |
| `raven_b` | string | RAVEN hash of `b` |
| `divergence` | object | `{ input, output_a, output_b }`. Present when `identical` is `false` |

Example call:

```json
{
  "name": "atracode_verify_equivalence",
  "arguments": {
    "a": { "path": "INTEREST.cbl" },
    "b": { "path": "interest.rs" }
  }
}
```

Result when the programs differ:

```json
{
  "identical": false,
  "raven_a": "13803fe6908d64b3301b931688e6244c99d9b80f15c781f5de7581abb7c3d2af",
  "raven_b": "9c41e07b52aa0f6e3d19c8b4407f2e15a6d0b93e7c58124f0e6ab3d9f1c27e85",
  "divergence": {
    "input": { "balance": 200, "rate_bp": 25, "years": 1 },
    "output_a": 201,
    "output_b": 200
  }
}
```

When `identical` is `true`, `raven_a` and `raven_b` are equal and there is no `divergence`.

## atracode_inspect_seg

Shows the structure of a compiled SEG. Pass a `raven_hash` from an earlier compile, or `source` or `path` to compile and inspect in one step.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `raven_hash` | string | One of `raven_hash`, `source` or `path` | Hash of a program you have compiled |
| `source` | string | One of the three | Program text |
| `path` | string | One of the three | Path to a source file |
| `language` | string | No | Front end to use with `source` or `path` |

Result:

| Field | Type | Description |
| --- | --- | --- |
| `inputs` | array | The values the program takes in |
| `membrane.reads` | array | Every read through the [memory membrane](/docs/memory-membrane) |
| `membrane.writes` | array | Every write through the memory membrane |
| `bounds.fuel` | number | The [fuel](/docs/fuel) budget for one execution |
| `bounds.widths` | object | Integer widths fixed at compile time |

Example call:

```json
{ "name": "atracode_inspect_seg", "arguments": { "path": "rotate.sh" } }
```

Result:

```json
{
  "inputs": ["timestamp", "log_dir"],
  "membrane": {
    "reads": ["log_dir/app.log"],
    "writes": ["log_dir/app.log.1"]
  },
  "bounds": {
    "fuel": 50000,
    "widths": { "timestamp": "i64" }
  }
}
```

## atracode_get_raven_hash

Returns the RAVEN hash and nothing else. Use it for caching, provenance and audit, when you only need the identity.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `source` | string | One of `source` or `path` | Program text |
| `path` | string | One of `source` or `path` | Path to a source file |
| `language` | string | No | Front end to use. Inferred from the file name when omitted |

Example call:

```json
{ "name": "atracode_get_raven_hash", "arguments": { "source": "def f(x):\n    return x * 2\n", "language": "python" } }
```

Result:

```json
{ "raven_hash": "2ce06a9e7f8c3e6bf85a6067d0b220fb0ad03de983053942a90c43e73ec76f89" }
```

## Refusals and divergences

Both come back as ordinary results, not as tool errors:

- A refusal is `"status": "refused"` with a `refusal` object. The compiler stopped at the exact `file`, `line` and `column` of a construct it cannot verify, and `hint` says how to fix it. Your agent should apply the hint and call the tool again.
- A divergence is `"identical": false` with a `divergence` object. `input` is a concrete input on which the two programs disagree, and `output_a` and `output_b` are what each one produced. Your agent can run that input itself to reproduce the difference.

Tool errors are reserved for calls that could not run at all: a missing or rejected API key, an exhausted quota, invalid arguments, or the service being unavailable. [Errors](/docs/errors) describes each one.

> **Tip:** Tell your agent in its instructions that a refusal is feedback to act on, so it fixes the code instead of retrying the same call.

## Next steps

- [MCP server](/docs/mcp-server): install and configure the server
- [Refusals](/docs/refusals): common refusal reasons and fixes
- [RAVEN](/docs/raven): what the hash identifies
- [Errors](/docs/errors): failures that are not refusals
