SplicedockUSER DOCUMENTATIONGitHub
Contents
USER GUIDE

Reads run. Spending waits for you.

Deny or require approval for calls of any tool type based on their arguments.

On this page

An argument policy checks what a call is about to send. It can deny it or hold it for your approval on your phone. This page shows how to set it up, test it and fix it.

What it does

The args part of an access policy looks at the arguments of a call before the gateway sends it. It works on every tool type. A rule can deny the call or hold it until you approve it on your phone. Calls that match no rule run as before.

Use it so reads run freely and anything that spends money or messages a new person waits for your yes. CLI passthrough tools also have cli rules that read the argument array. They are on Every policy mechanism. This page covers args, which reads the JSON arguments of a call.

Where it lives. The tool definition under tools: holds only usage and authentication. Access policy goes under policy_defaults.<tool> for every profile, or profiles.<profile>.policy.<tool> for one profile. The key is the name from the tool config, such as send or crm, not the exposed name pay__send. A profile entry replaces the default whole. See Access policy. For mcp_proxy the policy covers every tool of that backend, so each rule can carry a tool glob.

Quick start

  1. Add the policy. Define the tool under tools: and put the rule under policy_defaults, keyed by the tool name. Here a payment tool needs approval above 100.
Gateway configuration
tools:
  - type: http
    namespace: pay
    name: send
    description: Send a payment
    method: POST
    url: https://payments.example.internal/v1/payments
    params:
      - { name: amount, in: body, required: true }
      - { name: recipient, in: body, required: true }
      - { name: note, in: body }
    auth: { type: none }

policy_defaults:
  send:
    args:
      rules:
        - name: big-payment
          when: { path: amount, gt: 100 }
          action: approval
  1. Restart the gateway. The policy is compiled at startup. A bad path or regex stops the startup with a message (see Troubleshooting).
  2. Add pay__send to the profile manifest as usual.
  3. The agent calls the tool with amount: 50. No rule matches, so it runs.
  4. The agent calls it with amount: 500. The call does not reach the API. The agent gets an error result:
Result seen by the agent (isError: true)
Approval required: {"approval_id":"7b1c…","op_hash":"…","canonical_argv":"{\"amount\":500,\"recipient\":\"acme\"}","expires_at":1767000000000,"retry_hint":"Retry the SAME arguments with the same profile token after operator approval; any change to the arguments needs a new approval"}. Retry the SAME arguments within 600s after approval (approval id: 7b1c…).

The agent then waits for you with the approvals tool, up to 120 seconds per call:

Arguments for approvals__wait
{"id":"7b1c…","timeout_s":120}
  1. You approve on your phone in the approvals page. The card shows the tool, the rule name and a redacted preview of the arguments.
  2. The agent retries the exact same call. It runs once. The approval is spent when the request is sent.

A rule with action: deny never waits. The agent sees this and the call is not sent:

Result seen by the agent (isError: true)
Denied by policy.args_policy.secret

How rules work

  • A policy is a list of rules (1 to 200). Each rule has when and action, and optionally name and tool.
  • Rules are checked in order. Deny wins over approval, even if the approval rule comes first.
  • No match means the call is allowed.
  • when is one condition or a list. A list is ANDed: every condition must match.
  • name is the label in errors and logs. Without it the label is the position, such as #2.
  • tool is a glob on the full tool name, such as mail__send*. It matters for mcp_proxy, where one config covers many upstream tools. Upstream tool names are not known at startup, so a glob that matches nothing is not reported.
  • Key order, spacing and Unicode escapes in the JSON do not change the result. The policy reads the parsed values.

Path syntax

A path is dotted keys plus array indexes. It starts from the top of the tool arguments.

PathReadsExample arguments
amountA top-level key.{"amount": 500}
payment.amountA nested key.{"payment":{"amount":500}}
to[0]An array element by index.{"to":["a@x.com","b@y.com"]}
items[2].priceA key inside an array element.{"items":[{},{},{"price":9}]}
a.b[0].cAny mix of the above.{"a":{"b":[{"c":1}]}}

Only own properties are read. Names such as __proto__ or constructor never resolve. There are no wildcards. To check every element of an array, list each index you accept, or use regex on a string field.

Operator reference

A condition is a path plus at least one operator. Several operators in one condition are ANDed too.

OperatorMatches whenValue typeMissing pathExample
equalsThe value is equal. Strings, numbers and booleans compare by their text, so the string "5" equals the number 5. A number rule also matches a numeric string such as "100.0" or " 0100". Backends often parse those, so this closes a bypass. Objects and arrays never equal a scalar.string, number, boolean, nullNo match{ path: currency, equals: "EUR" }
inThe value equals any listed item (same text rule as equals).list of 1 to 1000 scalarsNo match{ path: region, in: [eu, us] }
not_inThe value equals none of the listed items (same comparison as equals).list of 1 to 1000 scalarsMatches{ path: to, not_in: ["a@corp.example"] }
regexThe string value matches (unanchored search). A non-string never matches.string up to 500 chars, optional flagsNo match{ path: body, regex: "password", flags: i }
gt, gte, lt, lteThe number compares as stated. A string or other non-number does not match, and the call is denied (fail closed).finite numberNo match{ path: amount, gt: 100 }
existstrue: the path is present (even if null). false: the path is absent.booleanexists: false matches{ path: cc, exists: true }

Fail closed. A missing path never matches, with two exceptions: not_in and exists: false. So an allowlist written as not_in also catches calls that leave the field out. Numeric operators on a non-number (for example "500" sent as text) deny the call, so a number sent as a string cannot slip under a limit.

flags may use i, m, s, u, each once. Inline (?i) is not supported. Regexes are compiled at startup. As with the CLI regexes, a pattern that backtracks badly can be slow, so keep patterns simple.

Recipes

Each recipe is complete. Copy it, change the names and restart the gateway.

1. Spend limit

Small payments run. Above 100 you approve. Above 10000 the call is denied. Deny wins, so the order does not matter.

Gateway configuration
tools:
  - type: http
    namespace: pay
    name: send
    description: Send a payment
    method: POST
    url: https://payments.example.internal/v1/payments
    params:
      - { name: amount, in: body, required: true }
      - { name: recipient, in: body, required: true }
      - { name: note, in: body }
    auth: { type: none }

policy_defaults:
  send:
    args:
      rules:
        - name: huge-payment
          when: { path: amount, gt: 10000 }
          action: deny
        - name: big-payment
          when: { path: amount, gt: 100 }
          action: approval

2. Recipient allowlist for a mail tool

Mail to known addresses runs. Any other recipient needs approval. not_in also catches a call with no to field.

Gateway configuration
tools:
  - type: http
    namespace: mail
    name: send_email
    description: Send an email
    method: POST
    url: https://mail.example.internal/v1/send
    params:
      - { name: to, in: body, required: true }
      - { name: subject, in: body }
      - { name: body, in: body }
    auth: { type: none }

policy_defaults:
  send_email:
    args:
      rules:
        - name: new-recipient
          when: { path: to, not_in: ["alice@corp.example", "bob@corp.example"] }
          action: approval

3. Deny a secret-looking body

Block messages that look like they carry a key or a private block, whatever the recipient. This rule goes in the same args.rules list as recipe 2. A policy entry replaces the whole entry below it, so list both rules together.

Replace policy_defaults.send_email
policy_defaults:
  send_email:
    args:
      rules:
        - name: secret-in-body
          when: { path: body, regex: "(api[_-]?key|secret|password|BEGIN [A-Z ]*PRIVATE KEY)", flags: i }
          action: deny
        - name: new-recipient
          when: { path: to, not_in: ["alice@corp.example", "bob@corp.example"] }
          action: approval

4. Reads run freely, writes need approval

An mcp_proxy backend named crm exposes crm__list_contacts, crm__get_contact, crm__create_contact and crm__delete_contact. The profile lists the whole backend with a glob. The policy holds back the writes by tool name. Reads match no rule, so they run.

Gateway configuration
tools:
  - type: mcp_proxy
    name: crm
    service_dns: crm.internal
    port: 9100
    transport: streamable_http

policy_defaults:
  crm:
    args:
      rules:
        - name: crm-delete
          tool: "crm__delete_*"
          when: { path: id, exists: true }
          action: deny
        - name: crm-create
          tool: "crm__create_*"
          when: { path: email, exists: true }
          action: approval
Profile manifest
tools:
  - "crm__*"
enable_code_mode: false
policy: {}

A rule needs a condition, so each write rule tests a field that the write always sends (id or email here). If a write tool does not send that field, the rule does not match and the call runs. Check each write tool, and add one rule per tool you care about.

5. Stricter rules for one profile

Give the profile ops a different policy for the payment tool. A profile entry replaces the default whole, so repeat every rule that profile should keep. An entry that only sets args also drops the default cli part, which matters only for CLI tools. Add require_strong: true to ask for a hardware-key approval whenever a rule holds the call.

Gateway configuration
profiles:
  ops:
    tools: ["pay__*"]
    policy:
      send:
        args:
          rules:
            - name: any-payment
              when: { path: amount, gt: 0 }
              action: approval
        require_strong: true

Test a policy before you enable it

There is no shadow mode. A policy that applies to a tool is always enforced. The guard has a dry-run mode, but the gateway uses it only for Code Mode preflight (exchange), where deny rules block and nothing is sent. You cannot switch it on for normal calls.

Safe ways to try a rule:

  1. Point a copy of the tool at a harmless URL, such as a local echo server, and give the copy its own policy entry there.
  2. Start with action: approval. Nothing is sent until you approve, you can reject the card, and the audit log shows which rule fired.
  3. Change to deny once the audit log shows only the calls you expect.

Unit tests for your own rules are easy to write against compileArgsPolicy and evaluateArgsPolicy in src/services/policy/args. The repository tests there are a good template.

Reading the audit log

EntryMeaning
decision: deny, rule args_policy.big-paymentThe call was held for approval or denied by that rule. A waiting approval also shows in the approvals view.
decision: allow, rule args_policy.big-paymentAn approval for that rule was used and the call was sent.
rule args_policy.unevaluableThe arguments could not be read as plain JSON, for example a number that is not finite. The call is denied.
argv_lenThe number of top-level argument keys. Argument values are never written to the audit log or metrics.

How approval is bound to the call

An approval is one-shot and tied to the exact call. The hash covers the tool id and the arguments as canonical JSON with sorted keys. Key order does not matter, but any changed value does. The approval is spent when the gateway sends the request. If the gateway fails before sending, it is released, so you do not lose it. The approvals card shows a preview of the arguments with secret-looking values redacted.

Troubleshooting

Startup messageCause and fix
invalid path: …The path does not parse. Check dots, brackets and empty segments, for example a..b or a[.
condition needs at least one operator (equals, in, not_in, regex, gt, gte, lt, lte, exists)A condition has only path. Add an operator.
flags requires regexflags was set without regex.
invalid flags: use only i, m, s, u, each onceRemove unknown or repeated flags. Use flags: i instead of (?i).
regex longer than 500 charactersSplit the rule or simplify the pattern.
invalid regex: …The pattern does not compile. Escape special characters.
'args_policy' moved in 3.0 or 'policy' moved in 3.0The old key is still on the tool. Move the rules to policy_defaults.<tool>.args or .cli. See Access policy.
no tool named …A key under policy_defaults or a profile policy is not a tool name from tools:. Use the config name, not the exposed name with its namespace.

Messages the agent can see:

MessageMeaning
Denied by policy.args_policy.<rule>A deny rule matched, or an approval was rejected or expired.
args policy is not ready yet; retry shortlyThe gateway is still starting. Retry.
args policy is not availableA policy exists but no guard is wired. The call is refused.

FAQ and limits

Does matching normalize Unicode?

No. Matching is exact by code point. A precomposed "é" and an "e" with a combining accent are different strings. If a backend normalizes text, list both forms, or write a regex that covers both.

Why does a retry with changed arguments need a new approval?

Because you approved those exact arguments. If the agent changes the amount or the recipient, it is a different operation. A retry with the same arguments is accepted, in any key order.

Can I set it per profile?

Yes. Use profiles.<profile>.policy.<tool>.args. It replaces policy_defaults.<tool> for that profile, with no merging. Overrides saved from the admin API replace the file policy in the same way, and the most specific one wins: a stored override for the tool and profile, then a stored override for all profiles, then the profile entry, then the default.

Does it work for CLI tools?

Yes. args applies to any tool type. For a cli_passthrough tool the guard reads the JSON arguments of the call (for example {"args": [...]}), and the cli part of the same entry reads the argument array. Both must allow the call.

Which name do I use as the key?

The name from the tool config. For an http tool that is send, not pay__send. Two http tools with the same name in different namespaces share one key, so give them different names. An unknown name stops the gateway at startup.

What is require_strong?

require_strong: true on the policy entry makes every approval for that tool a strong one (WebAuthn), for both cli and args approvals.

What if no approval service is running?

An approval rule then acts as a deny.

Other limits

  • Canonical arguments must be at most 65536 characters. Larger calls are denied.
  • There are no wildcards in paths.
  • The tool glob in a rule is for mcp_proxy only. On any other tool type the gateway refuses to start.
  • For mcp_proxy, upstream tool names are not checked at startup.
  • For http, the policy checks the arguments the agent sent, not the final request after URL building.
  • It does not read the response.