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
- 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.
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.
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.
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")
Inherited methods
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product