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

What is an Enum Constraint?

2 min read Updated

Restricting a tool call argument to a predefined set of allowed values. Enum constraints enforce closed vocabularies — for example, currency must be one of GBP, USD, or EUR — ensuring agents cannot use arbitrary or unexpected values.

WHY IT MATTERS

Many tool call arguments have a finite set of valid values. A currency field should be an ISO currency code. A region field should be one of your deployed regions. An action type should be one of a known set. Enum constraints codify these restrictions in the policy layer rather than relying on the downstream server to reject invalid values.

Enforcing enums at the proxy level provides defence in depth. Even if the MCP server accepts invalid values (perhaps due to a bug or permissive schema), the policy layer catches them first. This is critical for agents that hallucinate plausible-looking but invalid values — a common failure mode in LLM-driven tool calling.

Enum constraints are also self-documenting. By listing the allowed values in the policy document, operators create a human-readable specification of what agents are permitted to do. This makes policy review straightforward and reduces ambiguity about what constitutes a valid tool call.

Enum 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 enum constraints as require conditions on a tool's arguments in the JSON policy document, edited in the dashboard's visual policy builder or its Raw JSON view. At evaluation time, the gateway checks whether the argument's value is present in the list. If not, the call is denied with a clear message stating which value was provided and which values are allowed. Enum checks are case-sensitive by default.

FREQUENTLY ASKED QUESTIONS

Are enum checks case-sensitive?
By default, yes. The argument value must exactly match one of the allowed values. Case-insensitive matching can be configured if needed.
Can I use enums with non-string arguments?
Yes. Enum constraints work with any JSON-serialisable type — strings, numbers, booleans. The list of allowed values can contain mixed types if the argument accepts them.
How do I update the allowed values without restarting the proxy?
Policies are edited and saved in the dashboard, where they are validated on save. The updated list takes effect at the gateway immediately — there is nothing to restart.

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.