Tool Validation
The tool-validation policy block does three input-stage checks:
- It checks requested tool names against
declared_tools. - It compiles each configured JSON Schema.
- It can call an external semantic validator.
This policy-stage check does not validate arguments in a subsequent tool call that the model generates. Use a supported pre-dispatch tool workflow when each actual action must have argument validation.
Phase and verdicts
- Phase: pre-execution / input-stage policy evaluation
- Verdicts:
alloworblock
Configuration
pack:
name: tool-validation-example-1
version: "1.0.0"
enabled: true
policies:
chain:
- tool-validation
policy:
tool-validation:
declared_tools:
- web_search
- database_query
schemas:
database_query:
type: object
properties:
table:
type: string
required:
- table
allow_undeclared: false
semantic_validation:
enabled: true
endpoint: https://validator.example.com/judge
model: judge
secret_key_ref:
env: VERDICTAN_VALIDATOR_API_KEY
timeout_ms: 3000
Supported fields
| Field | Type | Default | Notes |
|---|---|---|---|
declared_tools | string[] | [] | Allowlist for requested tool names. |
schemas | object | {} | Map of tool names to JSON Schemas. |
allow_undeclared | boolean | false | A value of false blocks undeclared tool names. |
semantic_validation.enabled | boolean | false | Enables the external semantic validator call. |
semantic_validation.endpoint | string | — | Necessary when semantic validation is enabled. |
semantic_validation.model | string | — | Sent in the validator payload. If not specified, the runtime falls back to judge. |
semantic_validation.secret_key_ref | object | — | Use secret_key_ref.env for the bearer token environment variable. |
semantic_validation.timeout_ms | integer | 3000 | Request timeout for the validator call. |
What the policy validates
Requested tools
The policy gets tool names from:
- OpenAI-style
tools[*].function.name - MCP-bridge-style
tools[*].name
Schemas
The policy compiles configured schemas with the JSON Schema library (Draft 7).
Important: The policy checks each JSON Schema. It does not validate tool-call arguments against the schema.
Semantic validation
When enabled, the policy POSTs a payload containing:
declared_toolsschemas- the request's
toolsarray
The response must have one of these shapes:
- include a top-level
valid: true|false, or - include OpenAI-style
choices[0].message.contentJSON with avalidfield
A validator error, timeout, malformed response, or valid: false result blocks the request.
Behavior notes
- Semantic validation blocks on an error.
allow_undeclared: trueallows undeclared tool names but continues to record them in the policy details payload.- Use Tool Security for pattern checks on the serialized input request.
- Use pre-dispatch validation when each actual tool-call argument must match its schema.
Minimal correct example
policy:
tool-validation:
declared_tools:
- search