Parameter Constraints
Validate and restrict the values passed to tool parameters.
Pattern matching
Use regex patterns to validate parameter values:
{
"type": "params",
"config": {
"tool": "write_file",
"rules": {
"path": {
"must_match": "^/tmp/",
"must_not_match": "\\.\\."
}
}
}
}This ensures files can only be written to /tmp/ and blocks path traversal attempts.
Allowed values
Restrict a parameter to specific values:
{
"type": "params",
"config": {
"tool": "set_priority",
"rules": {
"priority": {
"allowed_values": ["low", "medium", "high"]
}
}
}
}Numeric ranges
Constrain numeric parameters:
{
"type": "params",
"config": {
"tool": "transfer_funds",
"rules": {
"amount": {
"min": 0,
"max": 10000
}
}
}
}Required parameters
Ensure certain parameters are always provided:
{
"type": "params",
"config": {
"tool": "delete_user",
"rules": {
"reason": {
"required": true,
"min_length": 10
}
}
}
}Multiple tools
Apply the same rules to multiple tools:
{
"type": "params",
"config": {
"tools": ["create_*", "update_*"],
"rules": {
"owner": {
"must_match": "^team-"
}
}
}
}Example: Safe SQL queries
{
"name": "Safe SQL",
"type": "params",
"config": {
"tool": "execute_query",
"rules": {
"query": {
"must_not_match": "(DROP|DELETE|TRUNCATE|ALTER)\\s",
"max_length": 1000
}
}
}
}