Safe parameter extraction with type checking and path navigation.
This extractor provides two modes of operation:
- Simple mode: Returns Either[String, T] for backward compatibility
- Enhanced mode: Returns Either[ToolParameterError, T] for structured error reporting
Value parameters
- call
-
The tool call being run, when the caller knows it: an agent sets it for every call, with the call's id and idempotency key (ToolCallInfo); plain ToolRegistry tool calling leaves it
None. - params
-
The JSON parameters to extract from
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Extract a required JSON array parameter from the JSON params.
Extract a required JSON array parameter from the JSON params.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(ujson.Arr)on success,Left(errorMessage)on failure
Extract a required JSON array parameter with structured error reporting.
Extract a required JSON array parameter with structured error reporting.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(ujson.Arr)on success,Left(ToolParameterError)on failure
Extract a required boolean parameter from the JSON params.
Extract a required boolean parameter from the JSON params.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(value)on success,Left(errorMessage)on failure
Extract a required boolean parameter with structured error reporting.
Extract a required boolean parameter with structured error reporting.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(value)on success,Left(ToolParameterError)on failure
Extract a required double (number) parameter from the JSON params.
Extract a required double (number) parameter from the JSON params.
A whole number above 2^53 (9007199254740992) has already been rounded to the nearest double when the tool call's arguments were parsed, so it cannot be recovered here. Declare large identifiers as strings in the tool's schema.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(value)on success,Left(errorMessage)on failure
Extract a required double (number) parameter with structured error reporting.
Extract a required double (number) parameter with structured error reporting.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(value)on success,Left(ToolParameterError)on failure
Extract a required integer parameter from the JSON params.
Extract a required integer parameter from the JSON params.
JSON numbers reach this class as doubles, so an integer is a number with no fractional part that fits in an Int: 3, 3.0, 1e2 and -0.0 are accepted; 3.14, 2147483648, 1e10 and anything too large are refused as a type mismatch instead of being truncated or wrapped around, so a model that sends one gets an error it can correct.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(value)on success,Left(errorMessage)on failure
Extract a required integer parameter with structured error reporting.
Extract a required integer parameter with structured error reporting.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(value)on success,Left(ToolParameterError)on failure
Extract a required JSON object parameter from the JSON params.
Extract a required JSON object parameter from the JSON params.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(ujson.Obj)on success,Left(errorMessage)on failure
Extract a required JSON object parameter with structured error reporting.
Extract a required JSON object parameter with structured error reporting.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(ujson.Obj)on success,Left(ToolParameterError)on failure
Extract an optional boolean parameter. Returns Right(None) when the parameter is absent.
Extract an optional boolean parameter. Returns Right(None) when the parameter is absent.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(Some(value))if present,Right(None)if absent,Lefton type mismatch
Extract an optional double (number) parameter. Returns Right(None) when the parameter is absent.
Extract an optional double (number) parameter. Returns Right(None) when the parameter is absent.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(Some(value))if present,Right(None)if absent,Lefton type mismatch
Extract an optional integer parameter. Returns Right(None) when the parameter is absent.
Extract an optional integer parameter. Returns Right(None) when the parameter is absent.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(Some(value))if present,Right(None)if absent,Lefton type mismatch
Extract an optional string parameter. Returns Right(None) when the parameter is absent.
Extract an optional string parameter. Returns Right(None) when the parameter is absent.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(Some(value))if present,Right(None)if absent,Lefton type mismatch
Extract a required string parameter from the JSON params.
Extract a required string parameter from the JSON params.
Value parameters
- path
-
Dot-separated path to the parameter (e.g.,
"user.name")
Attributes
- Returns
-
Right(value)on success,Left(errorMessage)if the parameter is absent or not a string
Extract a required string parameter with structured error reporting.
Extract a required string parameter with structured error reporting.
Value parameters
- path
-
Dot-separated path to the parameter
Attributes
- Returns
-
Right(value)on success,Left(ToolParameterError)on failure
Validate all required parameters at once and collect all errors.
Validate all required parameters at once and collect all errors.
Useful for upfront validation before any business logic runs.
expectedType is one of string, integer, number, boolean, array or object, checked with the same rules as the typed getters (integer is a whole number in the Int range). A type name this method does not know is checked for presence only.
Value parameters
- requirements
-
Pairs of
(path, expectedType)to validate
Attributes
- Returns
-
Right(())if all parameters are present and have the correct types,Left(errors)with the full list of validation failures otherwise - Example
-
extractor.validateRequired("name" -> "string", "age" -> "integer")
An extractor for the given call.
An extractor for the given call.
Attributes
An extractor for the given call, or for no call.
An extractor for the given call, or for no call.
Attributes
An extractor over other parameters, for the same call.
An extractor over other parameters, for the same call.
Attributes
Inherited methods
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product