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.

HOW POLICYLAYER USES THIS

Intercept supports numeric range constraints in YAML policies via min and max fields on argument rules. Both are optional — you can set just a minimum, just a maximum, or both. Intercept parses the argument value as a number and evaluates it against the bounds. Values outside the range are denied with a clear message stating the allowed range.

FREQUENTLY ASKED QUESTIONS

Can I set only a minimum or only a maximum?
Yes. Both min and max are optional. Setting only min creates a floor (e.g. amount must be at least 1). Setting only max creates a ceiling (e.g. limit must not exceed 1000).
Are range boundaries inclusive or exclusive?
Range boundaries are inclusive by default — min: 0 and max: 100 allows both 0 and 100. Exclusive boundaries can be achieved by adjusting the values.
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

Enforce policies on every tool call

Intercept is the open-source MCP proxy that enforces YAML policies on AI agent tool calls. No code changes needed.

npx -y @policylayer/intercept
github.com/policylayer/intercept →
// GET IN TOUCH

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

Message sent.

We'll get back to you soon.