pub struct ToolInput { /* private fields */ }Expand description
Schema-bound, resource-limited arguments for one erased tool invocation.
Tool arguments must have an object root. Construction provides structural
and resource safety but does not execute JSON Schema validation; the trusted
ToolSchemaRegistry performs validation against the digest-pinned schema
before typed deserialization and before any tool code runs.
Implementations§
Source§impl ToolInput
impl ToolInput
Sourcepub fn new(
schema: SchemaReference,
value: BoundedJson,
) -> Result<Self, ToolInputError>
pub fn new( schema: SchemaReference, value: BoundedJson, ) -> Result<Self, ToolInputError>
Constructs object-root arguments from a bounded JSON value.
§Errors
Returns ToolInputError::ObjectRootRequired for a scalar or array root.
Sourcepub const fn schema(&self) -> &SchemaReference
pub const fn schema(&self) -> &SchemaReference
Returns the immutable input schema identity.
Sourcepub const fn value(&self) -> &BoundedJson
pub const fn value(&self) -> &BoundedJson
Returns the bounded arguments without permitting mutation.
Sourcepub fn into_parts(self) -> (SchemaReference, BoundedJson)
pub fn into_parts(self) -> (SchemaReference, BoundedJson)
Consumes the input and returns schema identity and arguments.
Sourcepub fn validate_for(
&self,
context: &ToolContext,
descriptor: &ToolDescriptor,
) -> Result<(), ToolInputValidationError>
pub fn validate_for( &self, context: &ToolContext, descriptor: &ToolDescriptor, ) -> Result<(), ToolInputValidationError>
Revalidates schema identity plus descriptor and run byte ceilings.
Actual JSON Schema evaluation is deliberately separate and must be performed through the registered local schema implementation.
§Errors
Returns ToolInputValidationError for a substituted context/schema or
input that exceeds a descriptor or remaining-run ceiling.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolInput
impl<'de> Deserialize<'de> for ToolInput
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for ToolInput
Source§impl JsonSchema for ToolInput
impl JsonSchema for ToolInput
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more