Tool rules
How to define a connected tool, and the finer rules on tool calls and swarm messages
Defining a tool
A tool is defined once per project and referred to by name from any policy.
tool payment-keys
host payments.example.com
traffic POST /v1/refunds* GET /v1/charges/*
attach Authorization: Bearer <key>
calls mcp| Line | What it holds |
|---|---|
tool <name> | The tool's name, as policies write it after use. |
host | The one host its key goes to. |
traffic | Groups of methods, each followed by its path prefixes. Paths end in *. A path before any method, or methods with nothing after them on a line that has paths, is refused rather than widened. A tool with no traffic line is refused. |
attach | Where the key goes, with <key> in its place. |
calls | Optional: mcp or json-rpc, how its requests carry tool calls. A call rule can name the tool only when this is set. |
Allow use <tool> grants the tool's key and its traffic, with the rule's verdict, and switches traffic reading on.
Rules on tool calls
Not available yet Rules on message topics and on tool calls are checked and compiled, and decide Deny until the sandboxes read them.
Allow use pay-mcp
Allow call pay-mcp refunds.create where amount <= 5000 and currency in usd,eur
Deny call pay-mcp refunds.* where currency = eur and amount >= 4000- The operation is the MCP tool name of a
tools/call, or the JSON-RPC method. Write it exactly, or as a start ending in*. - A test names an argument, with nested fields joined by
., and is=,in,<=or>=. It compares a whole number up to 2^53, or a string. Numbers compare exactly:5000.0and5e3are5000. Tests are joined withand. - A missing argument passes no test.
- How a call is decided. With no
userule, orDeny use, every call is refused. Withuseand no call rules,usedecides every call. Otherwise a call no rule matches is refused, and a matching one gets the stricter of the strictest call rule and theuserule. - What is read. One JSON-RPC 2.0 object of at most 1 MiB. A batch, a body that is not JSON, a key written twice, or a call with a missing or misshapen name or arguments is refused. An MCP request other than
tools/callis not a call, and the tool'suserule decides it.
A call rule without a use rule for its tool, or for a tool with no calls line, is refused.
Rules on swarm messages
Not available yet Rules on message topics and on tool calls are checked and compiled, and decide Deny until the sandboxes read them.
A message rule can carry conditions after its peer. Every condition must hold for the rule to match.
Allow msg to policy:review topic:results.* publish request max 64KiB
Deny msg to policy:self
Allow msg to policy:self role:worker as role:lead send request
Allow msg from policy:self role:lead| Condition | Matches |
|---|---|
topic:<name>, topic:<prefix>* | The topic of a publish or a request. A message to one sandbox has no topic. |
role:<name> | The other end's role in the swarm: up to 32 lowercase letters, digits and inner -. |
as role:<name> | This sandbox's own role. |
send, publish, request, reply | The kind of message. |
max <size> | A body of at most this size, written such as 512B, 64KiB or 1MiB. The size is at most 1 MiB. |
policy:self means the policy's own sandboxes. For each direction and peer, the strictest matching condition decides; when none matches, the plain rule for that peer does, or the default: Deny between policies, Allow inside one. Conditions only narrow; one condition can never undo another.
Pod sets the sender of every message from the sandbox it came from. Any sender the sandbox writes in the message itself is overwritten.