New Your team’s decisions, in one playbook every coding agent works from. Never answer your agent twice

What is a Range Constraint?

2 min read Updated

Restricting a numeric tool call argument to a minimum and/or maximum value. Range constraints set safe operational bounds — for example, ensuring a transfer amount stays between 0 and 10,000 or a query limit does not exceed 1,000 rows.

WHY IT MATTERS

Numeric arguments are among the highest-risk parameters in tool calls. An amount field, a count field, a limit field — these directly control how much an agent does. Without range constraints, a hallucinating agent might request a transfer of 999,999,999 or a database query returning 10 million rows.

Range constraints are the simplest and most effective guard against numeric overflows. A minimum of 0 prevents negative amounts. A maximum of 10,000 caps transaction size. A query limit ceiling prevents resource exhaustion. These rules are trivial to write and enormously effective at preventing costly mistakes.

Range constraints also interact well with other policy mechanisms. Combined with per-tool rate limits, they create a comprehensive throughput and magnitude envelope — limiting both how often and how much an agent can do. This defence-in-depth approach is far more robust than either mechanism alone.

Range Constraint isn't theory — define it as policy in PolicyLayer and it's enforced on every tool call.

ENFORCE THIS WITH POLICY →

Enforced before the call runs. Nothing to install.

HOW POLICYLAYER USES THIS

PolicyLayer expresses numeric range constraints as deny_if conditions on a tool's arguments in the JSON policy — for example denying a call when args.amount exceeds a ceiling or falls below a floor. Either bound can stand alone — a policy can set just a minimum, just a maximum, or both. PolicyLayer evaluates the argument value against each condition at the gateway before the call reaches the upstream server. Values outside the range are denied with a clear message stating which rule applied.

FREQUENTLY ASKED QUESTIONS

Can I set only a minimum or only a maximum?
Yes. Each bound is its own condition. A single deny_if rule creates a floor (e.g. amount must be at least 1) or a ceiling (e.g. limit must not exceed 1000); combining two rules bounds both ends.
Are range boundaries inclusive or exclusive?
That depends on the comparison the condition uses — a rule denying values over 100 still allows exactly 100, while one denying values of 100 or more excludes it. Write the comparison that matches the bound you intend.
What happens with non-numeric values?
If an argument expected to be numeric contains a non-numeric value, the range constraint fails and the call is denied. The denial message indicates a type mismatch.

FURTHER READING

// THE REGISTRY

Every MCP server your agents touch has a registry record.

Type a name, get the breakdown: verified identity, auth posture, risk grade, every tool classified, recommended policy. Re-checked continuously.

Teams ship this data inside their own products. See what a licence covers →

Take your agents live. Without losing control.

Route your MCP traffic through PolicyLayer. Every tool call is checked against your policy before it runs: allow, deny, or require approval. Per-identity grants. Full audit log. Live in minutes.

Instant setup, no code required.

46,500+ MCP servers and 515,000+ tools scanned and risk-classified.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.