pub struct ToolBuilder { /* private fields */ }
Expand description
Builder for creating tools with fluent API, advanced 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