Skip to main content

Module transform

Module transform 

Source
Expand description

Tool transformations for dynamic schema modification.

This module provides the ability to transform tools dynamically, allowing:

  • Renaming tools and their arguments
  • Modifying descriptions
  • Providing default values for arguments
  • Hiding arguments from the schema (while still providing values)
  • Wrapping tools with custom transformation functions

§Example

use fastmcp_server::transform::{ArgTransform, TransformedTool};

// Original tool with cryptic argument names
let original_tool = my_search_tool();

// Transform to be more LLM-friendly
let transformed = TransformedTool::from_tool(original_tool)
    .name("semantic_search")
    .description("Search for documents using natural language")
    .transform_arg("q", ArgTransform::new().name("query").description("Search query"))
    .transform_arg("n", ArgTransform::new().name("limit").default(10))
    .build();

Structs§

ArgTransform
Transformation rules for a single argument.
NotSet
Sentinel value for unset optional fields.
TransformedTool
A transformed tool that wraps another tool and applies transformations.
TransformedToolBuilder
Builder for creating transformed tools.