pub struct ToolBuilder { /* private fields */ }Expand description
Builder for creating tools with fluent API, validation, and enhanced metadata
Implementations§
Source§impl ToolBuilder
impl ToolBuilder
Sourcepub fn description<S: Into<String>>(self, description: S) -> Self
pub fn description<S: Into<String>>(self, description: S) -> Self
Set the tool description
Sourcepub fn validation_config(self, config: ValidationConfig) -> Self
pub fn validation_config(self, config: ValidationConfig) -> Self
Set custom validation configuration
Sourcepub fn strict_validation(self) -> Self
pub fn strict_validation(self) -> Self
Enable strict validation (no additional properties, strict types)
Sourcepub fn permissive_validation(self) -> Self
pub fn permissive_validation(self) -> Self
Enable permissive validation (allow additional properties, type coercion)
Sourcepub fn behavior_hints(self, hints: ToolBehaviorHints) -> Self
pub fn behavior_hints(self, hints: ToolBehaviorHints) -> Self
Set behavior hints for the tool
Sourcepub fn destructive(self) -> Self
pub fn destructive(self) -> Self
Mark tool as destructive
Sourcepub fn idempotent(self) -> Self
pub fn idempotent(self) -> Self
Mark tool as idempotent
Sourcepub fn requires_auth(self) -> Self
pub fn requires_auth(self) -> Self
Mark tool as requiring authentication
Sourcepub fn long_running(self) -> Self
pub fn long_running(self) -> Self
Mark tool as potentially long-running
Sourcepub fn resource_intensive(self) -> Self
pub fn resource_intensive(self) -> Self
Mark tool as resource-intensive
Sourcepub fn category(self, category: ToolCategory) -> Self
pub fn category(self, category: ToolCategory) -> Self
Set tool category
Sourcepub fn category_simple(self, primary: String, secondary: Option<String>) -> Self
pub fn category_simple(self, primary: String, secondary: Option<String>) -> Self
Set tool category with primary and secondary classification
Set tool author
Sourcepub fn deprecated(self, deprecation: ToolDeprecation) -> Self
pub fn deprecated(self, deprecation: ToolDeprecation) -> Self
Mark tool as deprecated
Sourcepub fn deprecated_simple<S: Into<String>>(self, reason: S) -> Self
pub fn deprecated_simple<S: Into<String>>(self, reason: S) -> Self
Mark tool as deprecated with simple reason
Sourcepub fn custom_metadata<S: Into<String>>(self, key: S, value: Value) -> Self
pub fn custom_metadata<S: Into<String>>(self, key: S, value: Value) -> Self
Add custom metadata field
Sourcepub fn build<H>(self, handler: H) -> McpResult<Tool>where
H: ToolHandler + 'static,
pub fn build<H>(self, handler: H) -> McpResult<Tool>where
H: ToolHandler + 'static,
Build the tool with the given handler
Sourcepub fn build_with_validation_chain<H>(
self,
handler: H,
validation_fn: impl Fn(&mut HashMap<String, Value>) -> McpResult<()> + Send + Sync + 'static,
) -> McpResult<ValidationChainTool>where
H: ToolHandler + 'static,
pub fn build_with_validation_chain<H>(
self,
handler: H,
validation_fn: impl Fn(&mut HashMap<String, Value>) -> McpResult<()> + Send + Sync + 'static,
) -> McpResult<ValidationChainTool>where
H: ToolHandler + 'static,
Build the tool with validation chain - allows chaining parameter validation
Auto Trait Implementations§
impl Freeze for ToolBuilder
impl RefUnwindSafe for ToolBuilder
impl Send for ToolBuilder
impl Sync for ToolBuilder
impl Unpin for ToolBuilder
impl UnsafeUnpin for ToolBuilder
impl UnwindSafe for ToolBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].