pub struct ToolSpec {
pub id: ToolId,
pub name: ToolName,
pub description: String,
pub input_schema: JsonSchema,
pub output_contract: ToolOutputContract,
pub limits: ToolLimits,
pub cancellation: ToolCancellationPolicy,
}Expand description
Immutable tool specification (no handler).
Fields§
§id: ToolIdStable id for request selection.
name: ToolNameName exposed to models/MCP.
description: StringBounded description.
input_schema: JsonSchemaInput JSON schema.
output_contract: ToolOutputContractOutput contract.
limits: ToolLimitsLimits.
cancellation: ToolCancellationPolicyCancellation policy.
Implementations§
Source§impl ToolSpec
impl ToolSpec
Sourcepub const MAX_DESCRIPTION_BYTES: usize
pub const MAX_DESCRIPTION_BYTES: usize
Maximum description bytes.
Sourcepub fn try_new(
id: ToolId,
name: ToolName,
description: impl Into<String>,
input_schema: JsonSchema,
output_contract: ToolOutputContract,
limits: ToolLimits,
cancellation: ToolCancellationPolicy,
) -> Result<Self, ToolContractError>
pub fn try_new( id: ToolId, name: ToolName, description: impl Into<String>, input_schema: JsonSchema, output_contract: ToolOutputContract, limits: ToolLimits, cancellation: ToolCancellationPolicy, ) -> Result<Self, ToolContractError>
Validate and construct a tool specification.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolSpec
impl<'de> Deserialize<'de> for ToolSpec
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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ToolSpec
Auto Trait Implementations§
impl Freeze for ToolSpec
impl RefUnwindSafe for ToolSpec
impl Send for ToolSpec
impl Sync for ToolSpec
impl Unpin for ToolSpec
impl UnsafeUnpin for ToolSpec
impl UnwindSafe for ToolSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more