pub struct ToolGenerator;Expand description
Tool generator for creating MCP tools from OpenAPI operations
Implementations§
Source§impl ToolGenerator
impl ToolGenerator
Sourcepub fn generate_tool_metadata(
operation: &Operation,
method: String,
path: String,
spec: &Spec,
skip_tool_description: bool,
skip_parameter_descriptions: bool,
) -> Result<ToolMetadata, Error>
pub fn generate_tool_metadata( operation: &Operation, method: String, path: String, spec: &Spec, skip_tool_description: bool, skip_parameter_descriptions: bool, ) -> Result<ToolMetadata, Error>
Generate tool metadata from an OpenAPI operation
§Errors
Returns an error if the operation cannot be converted to tool metadata
Sourcepub fn generate_openapi_tools(
tools_metadata: Vec<ToolMetadata>,
base_url: Option<Url>,
default_headers: Option<HeaderMap>,
) -> Result<Vec<Tool>, Error>
pub fn generate_openapi_tools( tools_metadata: Vec<ToolMetadata>, base_url: Option<Url>, default_headers: Option<HeaderMap>, ) -> Result<Vec<Tool>, Error>
Generate OpenApiTool instances from tool metadata with HTTP configuration
§Errors
Returns an error if any OpenApiTool cannot be created
Sourcepub fn extract_parameters(
tool_metadata: &ToolMetadata,
arguments: &Value,
) -> Result<ExtractedParameters, ToolCallValidationError>
pub fn extract_parameters( tool_metadata: &ToolMetadata, arguments: &Value, ) -> Result<ExtractedParameters, ToolCallValidationError>
Extract parameter values from MCP tool call arguments
§Errors
Returns an error if the arguments are invalid or missing required parameters
Sourcepub fn is_file_field(schema: &Schema) -> bool
pub fn is_file_field(schema: &Schema) -> bool
Check if a schema represents a file field based on its format.
Returns true if the schema has format: binary or format: byte,
which indicates a file upload field in multipart/form-data requests.
§Arguments
schema- The OpenAPI Schema to check
§Returns
true if the schema represents a file field, false otherwise
Auto Trait Implementations§
impl Freeze for ToolGenerator
impl RefUnwindSafe for ToolGenerator
impl Send for ToolGenerator
impl Sync for ToolGenerator
impl Unpin for ToolGenerator
impl UnwindSafe for ToolGenerator
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