constraint_validate
Check if a value matches a specified constraint, such as a valid JSON path or integer. Supports partial validation for incomplete inputs.
Instructions
Validate a value against an LMQL-style constraint.
Use this tool to check if a value satisfies a constraint before using it in other operations. Supports partial validation - can tell if an incomplete input could still become valid.
Output contract: Returns {"valid": bool, "error": str?, "is_partial": bool?, ...}. Side effects: None (read-only validation). Failure modes: ToolError if constraint name unknown.
Available constraints:
YQ_PATH: Valid yq path (e.g., '.users[0].name')
YQ_EXPRESSION: Valid yq expression with pipes (e.g., '.items | length')
CONFIG_FORMAT: Valid format ('json', 'yaml', 'toml', 'xml')
KEY_PATH: Dot-separated key path (e.g., 'config.database.host')
INT: Valid integer
JSON_VALUE: Valid JSON syntax
FILE_PATH: Valid file path syntax
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | Value to validate | |
| constraint_name | Yes | Name of the constraint to validate against (e.g., 'YQ_PATH', 'CONFIG_FORMAT', 'INT') |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hint | No | ||
| error | No | ||
| valid | Yes | ||
| value | No | ||
| constraint | No | ||
| is_partial | No |