### Quickstart: Define MCP Tools, Prompts, Resources, and Run Server Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Demonstrates defining annotated tools, prompts, and resources using Scala 3 macros and running an MCP server with ZIO. It includes annotations like @Tool, @Resource, and @Prompt, and server setup with FastMcpServer. ```Scala //> using scala 3.6.4 //> using dep com.tjclp::fast-mcp-scala:0.1.1 //> using options "-Xcheck-macros" "-experimental" import com.tjclp.fastmcp.core.{Tool, ToolParam, Prompt, PromptParam, Resource} import com.tjclp.fastmcp.server.FastMcpServer import com.tjclp.fastmcp.macros.RegistrationMacro.* import zio.* // Define annotated tools, prompts, and resources object Example: @Tool(name = Some("add"), description = Some("Add two numbers")) def add( @ToolParam("First operand") a: Double, @ToolParam("Second operand") b: Double ): Double = a + b @Prompt(name = Some("greet"), description = Some("Generate a greeting message")) def greet(@PromptParam("Name to greet") name: String): String = s"Hello, $name!" // Note: resource templates (templated URIs) are not yet supported; // coming soon when the MCP java‑sdk adds template support. @Resource(uri = "file://test", description = Some("Test resource")) def test(): String = "This is a test" object ExampleServer extends ZIOAppDefault: override def run = for server <- ZIO.succeed(FastMcpServer("ExampleServer")) _ <- ZIO.attempt(server.scanAnnotations[Example.type]) _ <- server.runStdio() yield () ``` -------------------------------- ### FastMCPScala Server Setup and Java Integration Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Explains the `setupServer` method, which configures the Java MCP server. It details the creation of Java `BiFunction` handlers to bridge Scala/ZIO logic with the Java SDK's synchronous callback structure, including argument conversion, ZIO execution, and result conversion. ```APIDOC FastMCPScala.setupServer(transportProvider: McpServerTransportProvider): - Instantiates and configures Java `McpSyncServer` or `McpAsyncServer`. - Defines `ServerCapabilities` based on registered tools, resources, or prompts. - Creates Java `BiFunction` handlers (e.g., `javaToolHandler`, `javaPromptHandler`) to bridge Scala/ZIO logic with Java SDK callbacks. - Accepts Java arguments (e.g., `McpSyncServerExchange`, `Map[String, Object]`). - Converts Java arguments to Scala types. - Creates Scala `Context`. - Calls appropriate manager method (e.g., `callTool`, `readResource`). - Executes ZIO effect synchronously using `Runtime.default.unsafe.run`. - Converts Scala result back to Java MCP SDK types (e.g., `McpSchema.CallToolResult`). - Handles ZIO errors and converts them to Java exceptions or MCP error responses. - Registers `BiFunction` handlers with the Java `McpServer` builder using `.tool()`, `.resource()`, `.prompt()` methods. - Builds and stores the `underlyingJavaServer`. ``` -------------------------------- ### Run Scala CLI Example with Main Class Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Command to run a specific main class using Scala CLI, including specifying dependencies. This is an alternative way to execute pre-compiled examples. ```Bash scala-cli \ -e '//> using dep com.tjclp::fast-mcp-scala:0.1.1' \ --main-class com.tjclp.fastmcp.examples.AnnotatedServer ``` -------------------------------- ### End-to-End Testing with StdioClientTransport Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Explains how to perform end-to-end testing by connecting a Stdio client to a running FastMCP Scala server. ```scala // Run the FastMCP Scala server using runStdio() // Connect to it using StdioClientTransport from the java-sdk // Verify actual protocol communication and behavior. ``` -------------------------------- ### zio-json Schema Generation (Conceptual) Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Illustrates the concept of using zio-json for schema generation, potentially mapping to McpSchema.JsonSchema. ```scala import zio.json._ import zio.json.ast.Json // Assuming ToolDefinition requires a JsonSchema // This is a conceptual example of how one might generate it // Define a Scala type that represents the schema structure // case class McpSchemaJsonSchema(type: String, properties: Map[String, McpSchemaJsonSchema], required: List[String]) // Example: Generating schema for a simple input case class ToolInput(name: String, value: Int) // Using zio-json's schema capabilities (may require custom mapping) // val toolInputSchema: Json = Json.Schema.from[ToolInput] // This would then need to be mapped to the McpSchema.JsonSchema format ``` -------------------------------- ### Run Scala CLI Script with Dependencies Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Command to execute a Scala CLI script, including specifying dependencies and compiler options. This is useful for running examples or standalone applications. ```Bash scala-cli scripts/quickstart.scala ``` -------------------------------- ### zio-json Codec Definition Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Example of defining a JSON codec for a Scala type using zio-json's implicit derivation. ```scala import zio.json._ case class Message(text: String, sender: String) object Message { // Define the implicit JsonCodec for Message given JsonCodec[Message] = DeriveJsonCodec.gen[Message] } ``` -------------------------------- ### ZIO Effect Wrapping and Execution Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Demonstrates how to wrap synchronous functions into ZIO effects and how to synchronously execute ZIO effects when interacting with Java SDKs requiring synchronous results. ```scala import zio._ // Wrapping a synchronous function val syncFunction: () => String = () => "Hello" val zioEffect: ZIO[Any, Throwable, String] = ZIO.attempt(syncFunction()) // Synchronous execution for Java SDK interop // Assuming 'javaSdkMethod' expects a synchronous result // val result: String = Runtime.default.unsafe.run(myZioEffect).getOrThrowFiberFailure() ``` -------------------------------- ### ZIO Error Handling Patterns Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Illustrates using ZIO's error handling mechanisms for expected errors and converting exceptions into specific error types. ```scala import zio._ // For expected errors like ToolNotFound val expectedError: ZIO[Any, String, Nothing] = ZIO.fail("ToolNotFound") // Converting Throwables to MCP errors or logging val riskyOperation: ZIO[Any, Throwable, Unit] = ??? val handledOperation: ZIO[Any, String, Unit] = riskyOperation.catchAll( e => ZIO.fail(s"An error occurred: ${e.getMessage}") // Convert Throwable to String error ) // Or mapping errors val mappedOperation: ZIO[Any, String, Unit] = riskyOperation.mapError(_.getMessage) // Map Throwable to its message string ``` -------------------------------- ### ToolManager API Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Manages registered tool definitions and their associated handler logic. Provides methods to add, retrieve, and call tools. ```APIDOC ToolManager: addTool(definition: ToolDefinition, handler: ZIO[Any, Throwable, Any]): Unit - Registers a tool definition and its ZIO-wrapped handler. - Parameters: - definition: The ToolDefinition object containing metadata. - handler: A ZIO effect that executes the tool's logic. callTool(name: String, args: Map[String, Any], context: Context): ZIO[Any, Throwable, Any] - Finds, validates arguments against schema, injects context, and executes the tool's handler. - Parameters: - name: The name of the tool to call. - args: A map of arguments for the tool. - context: The execution context. - Returns: A ZIO effect yielding the tool's result. getTool(name: String): Option[ToolDefinition] - Retrieves a tool definition by its name. listTools(): List[ToolDefinition] - Returns a list of all registered tool definitions. ``` -------------------------------- ### PromptManager API Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Manages registered prompt definitions and their associated handler logic. Provides methods to add, retrieve, and render prompts. ```APIDOC PromptManager: addPrompt(definition: PromptDefinition, handler: ZIO[Any, Throwable, Any]): Unit - Registers a prompt definition and its ZIO-wrapped handler. - Parameters: - definition: The PromptDefinition object containing prompt metadata and arguments. - handler: A ZIO effect that generates the prompt messages. renderPrompt(name: String, args: Map[String, Any], context: Context): ZIO[Any, Throwable, List[Message]] - Finds the prompt, validates required arguments, injects context, and executes the handler. - Parameters: - name: The name of the prompt to render. - args: A map of arguments for the prompt. - context: The execution context. - Returns: A ZIO effect yielding a list of messages. getPrompt(name: String): Option[PromptDefinition] - Retrieves a prompt definition by its name. listPrompts(): List[PromptDefinition] - Returns a list of all registered prompt definitions. ``` -------------------------------- ### FastMCPScala Server Initialization and API Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Details the initialization of the FastMCPScala server, including its constructor parameters and the role of decorator methods (`tool`, `resource`, `prompt`) in triggering metaprogramming logic. It also covers the MCP handler implementations and their delegation to manager methods. ```APIDOC FastMCPScala: __init__(name: String, version: String, settings: Any) - Initializes the server with a name, version, and settings. - Sets up internal managers. Decorator Methods (tool, resource, prompt): - Primary API for registering functionality. - Trigger metaprogramming logic via macros/reflection. - Do not perform direct registration; rely on compile-time or setup-time actions. MCP Handler Implementations (listTools, callTool, etc.): - Internal methods registered with the Java MCP server. - Delegate calls to corresponding Manager methods (e.g., toolManager.listToolDefinitions). - Perform Scala to Java type conversions using `toJava` helpers or implicit conversions. - Execute ZIO effects using `Runtime.default.unsafe.run(...).getOrThrowFiberFailure()` to integrate with synchronous Java callbacks. - Translate ZIO errors to MCP errors where possible. ``` -------------------------------- ### ZIO Java SDK Interoperability Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Shows how to convert Java SDK asynchronous return types like Mono and CompletableFuture into ZIO effects. ```scala import zio._ import java.util.concurrent.CompletableFuture import reactor.core.publisher.Mono // Assuming 'javaSdkCallCompletableFuture' returns a CompletableFuture[String] val javaSdkCallCompletableFuture: CompletableFuture[String] = ??? val zioFromFuture: ZIO[Any, Throwable, String] = ZIO.fromFutureJava(javaSdkCallCompletableFuture) // Assuming 'javaSdkCallMono' returns a Mono[String] val javaSdkCallMono: Mono[String] = ??? val zioFromMono: ZIO[Any, Throwable, String] = ZIO.fromMono(javaSdkCallMono) ``` -------------------------------- ### Java SDK Mocking for Scala Integration Tests Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Describes using Java SDK's mock transport providers for testing Scala components without actual network layers. ```scala // In Scala integration tests: // Use MockMcpClientTransport and MockMcpServerTransportProvider // from the java-sdk to simulate client-server interactions. // This allows testing handler invocation, argument passing, and result conversion // within the Scala FastMCPScala server implementation. ``` -------------------------------- ### FastMCPScala Server Run Methods Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Describes the different methods for running the FastMCP Scala server: `run`, `runStdio`, and `runSse`. It details how `runStdio` blocks indefinitely and notes the current unsupported status of `runSse`. ```APIDOC FastMCPScala.run(transport: McpServerTransportProvider): - Selects between `runStdio` or `runSse` based on the transport provider. FastMCPScala.runStdio(): - Creates a Java `StdioServerTransportProvider`. - Calls `setupServer` with the stdio provider. - Blocks the ZIO fiber indefinitely, as the Java transport manages the main loop. - Logs server start. FastMCPScala.runSse(): - NOT YET SUPPORTED. - Requires integration with a Java SSE transport provider (e.g., `WebFluxSseServerTransportProvider`). - Would involve starting an underlying web server (e.g., Netty via ZIO HTTP) and integrating its lifecycle with the ZIO runtime. ``` -------------------------------- ### Declare Dependencies in build.sbt Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Configures project dependencies for Scala 3, ZIO, and the Java MCP SDK in the `build.sbt` file. Includes Scala version, ZIO versions, and the MCP Java SDK artifact. ```sbt // build.sbt ThisBuild / version := "0.1.0-SNAPSHOT" ThisBuild / scalaVersion := "3.6.4" val zioVersion = "2.1.16" val mcpJavaSdkVersion = "0.8.1" // Or the latest stable version lazy val root = (project in file(".")) .settings( name := "fast-mcp-scala", libraryDependencies ++= Seq( "dev.zio" %% "zio" % zioVersion, "dev.zio" %% "zio-json" % "0.7.39", // For JSON schema and potentially data handling "io.modelcontextprotocol.sdk" % "mcp" % mcpJavaSdkVersion ), // Add compiler options for macros if needed later // scalacOptions ++= Seq("-Xmacros:enable") // Example ) ``` -------------------------------- ### ResourceManager API Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Manages registered resource definitions (static and template) and their associated handler logic. Provides methods to add, retrieve, and read resources. ```APIDOC ResourceManager: addResource(definition: ResourceDefinition, handler: ZIO[Any, Throwable, Any]): Unit - Registers a static resource definition and its ZIO-wrapped handler. - Parameters: - definition: The static ResourceDefinition object. - handler: A ZIO effect that provides the resource content. addTemplate(definition: ResourceDefinition, handler: ZIO[Any, Throwable, Any]): Unit - Registers a resource template definition and its ZIO-wrapped handler. - Parameters: - definition: The template ResourceDefinition object (e.g., with URI parameters). - handler: A ZIO effect that generates the resource content based on parameters. readResource(uri: String, context: Context): ZIO[Any, Throwable, String | Array[Byte]] - Checks for concrete resources first, then templates matching the URI. - Executes the appropriate handler with extracted parameters and injected context. - Parameters: - uri: The URI of the resource to read. - context: The execution context. - Returns: A ZIO effect yielding the resource content (String or Array[Byte]). getResource(name: String): Option[ResourceDefinition] - Retrieves a resource definition by its name. listResources(): List[ResourceDefinition] - Returns a list of all registered resource definitions. ``` -------------------------------- ### Scala 3 Macro Performance Tuning Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Configuration options and best practices for optimizing Scala 3 compile-time macro performance within the FastMCP project. ```Scala scalacOptions += "-Xmax-inlines:128" // Consider setting -Xmacro-settings:verbose during development for debugging ``` -------------------------------- ### FastMCP Scala Metaprogramming Tasks Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Key tasks involved in the Scala 3 compile-time metaprogramming strategy for converting annotated Scala methods into MCP definitions. ```Scala // 1. Identify Annotations: Find methods annotated with @Tool, @Resource, or @Prompt. // 2. Extract Metadata: Get name, description, analyze signature (params, types, ZIO-based). // 3. Generate Definitions: Create ToolDefinition, ResourceDefinition, PromptDefinition instances. // - For @Tool: Generate inputSchema (e.g., using zio-json). // - For @Resource: Extract URI params, store function reference. // - For @Prompt: Generate PromptArgument list, store function reference. // 4. Generate Handlers: Create ZIO-wrapped functions for argument parsing, context injection, method calling, error handling. // 5. Register: Generate code to call addTool, addResource, addPrompt on manager instances. ``` -------------------------------- ### Define Core Data Types and JSON Codecs Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Illustrates the definition of Scala case classes and traits for MCP core types like `Content` and `TextContent`. Includes `zio-json` codecs for serialization and `toJava` methods for SDK interoperability. ```scala package fastmcp.core import zio.json.* import io.modelcontextprotocol.spec.McpSchema import scala.jdk.CollectionConverters.* // ... (other types) sealed trait Content(`type`: String): def toJava: McpSchema.Content object Content: given JsonCodec[core.TextContent] = DeriveJsonCodec.gen[TextContent] // ... codecs for other content types ... given JsonCodec[core.Content] = DeriveJsonCodec.gen[core.Content] // For the sealed trait case class TextContent( ...) extends Content("text"): override def toJava: McpSchema.TextContent = ... // conversion logic // ... (Message, Role with codecs and toJava) ``` -------------------------------- ### Context Class Scala API for Java Exchange Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/guide.md Details the `Context` class, which provides a Scala-friendly API over the Java SDK's exchange object. It covers accessing client capabilities, logging, reporting progress, and reading resources. ```APIDOC Context: Fields: - Stores an `Option[McpSyncServerExchange]` or `Option[McpAsyncServerExchange]`. Methods: - getClientCapabilities(): Accesses client properties from the Java exchange. - getClientInfo(): Accesses client information from the Java exchange. - log(level: String, message: String, loggerName: String): - Delegates to `underlyingJavaServer.loggingNotification(...)`. - Requires access to `FastMCPScala` instance or transport provider. - reportProgress(current: Long, total: Long): - Delegates to `javaExchange.get.getSession.sendProgressNotification(...)` (or similar Java SDK method). - readResource(uri: String): - Delegates to `this.server.readResource(uri)`. - Requires a reference back to the `FastMCPScala` instance. - Wraps Java calls in `ZIO.fromFutureJava` or `ZIO.attemptBlocking` if the underlying Java call is async/blocking. - Convenience methods (debug, info, warning, error): - Provide simplified logging interfaces. ``` -------------------------------- ### Scala Converter with Input Transformation Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/jackson-converter-enhancements.md Demonstrates using `contramap` to transform input data before conversion, specifically for a `User` case class. This example parses a string like "name:age" into a Map suitable for the derived converter. ```scala import com.tjclp.fastmcp.macros.DeriveJacksonConverter import com.tjclp.fastmcp.core.JacksonConverter case class User(name: String, age: Int) // Convert strings in "name:age" format given JacksonConverter[User] = DeriveJacksonConverter.derived[User].contramap[String] { str => str.split(":") match case Array(name, age) => Map("name" -> name, "age" -> age.toInt) case _ => str // Let default converter handle it } ``` -------------------------------- ### Custom Scala Converter for Filter Class Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/jackson-converter-enhancements.md Provides an example of defining a custom JacksonConverter for a `Filter` case class. It shows both automatic derivation and a custom implementation using a partial function to handle Map inputs with flexible field access. ```scala import com.tjclp.fastmcp.macros.DeriveJacksonConverter import com.tjclp.fastmcp.core.JacksonConverter case class Filter(column: String, op: String, value: String) // Automatic derivation given JacksonConverter[Filter] = DeriveJacksonConverter.derived[Filter] // Custom converter with flexible input given JacksonConverter[Filter] = JacksonConverter.fromPartialFunction[Filter] { case map: Map[String, Any] => Filter( column = map("column").toString, op = map.getOrElse("op", "=").toString, value = map("value").toString ) } ``` -------------------------------- ### Package fast-mcp-scala Library with sbt Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Command to package the fast-mcp-scala library into a JAR file using sbt. This JAR can then be manually copied to other projects. ```Bash # Package the library sbt package ``` -------------------------------- ### Claude Desktop MCP Server Configuration Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md JSON configuration for Claude Desktop to connect to a FastMCP-Scala server. It specifies the command and arguments needed to launch the server via scala-cli. ```JSON { "mcpServers": { "example-fast-mcp-server": { "command": "scala-cli", "args": [ "-e", "//> using dep com.tjclp::fast-mcp-scala:0.1.1", "--main-class", "com.tjclp.fastmcp.examples.AnnotatedServer" ] } } } ``` -------------------------------- ### Publish fast-mcp-scala to Local Ivy Repository Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Command to publish the fast-mcp-scala library to the local Ivy repository using sbt. This allows consuming the library from local development builds. ```Bash # From the fast-mcp-scala root sbt publishLocal ``` -------------------------------- ### Use fast-mcp-scala with scala-cli and Local JAR Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Configures a scala-cli project to use the fast-mcp-scala library by pointing directly to a local JAR file. This bypasses dependency management systems for local testing. ```Scala //> using scala 3.6.4 //> using lib "/absolute/path/to/fast-mcp-scala_3-0.1.1.jar" //> using options "-Xcheck-macros" "-experimental" ``` -------------------------------- ### Copy Packaged JAR to Project Lib Folder Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Manually copies the packaged fast-mcp-scala JAR file to the 'lib/' directory of another project. sbt automatically picks up unmanaged JARs in the lib/ folder. ```Bash # Copy the JAR – adjust Scala version / name if you change them cp target/scala-3.6.4/fast-mcp-scala_3-0.1.1-SNAPSHOT.jar \ /path/to/other-project/lib/ ``` -------------------------------- ### Use Local Snapshot Dependency in build.sbt Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Specifies the dependency for a local snapshot version of the fast-mcp-scala library in a consuming project's build.sbt file. ```Scala libraryDependencies += "com.tjclp" %% "fast-mcp-scala" % "0.1.1-SNAPSHOT" ``` -------------------------------- ### Add fast-mcp-scala to build.sbt Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/README.md Specifies the dependency for the fast-mcp-scala library in a Scala project's build.sbt file. This ensures the library is available for use in your project. ```Scala libraryDependencies += "com.tjclp" %% "fast-mcp-scala" % "0.1.1" ``` -------------------------------- ### Create Scala Converter from Partial Function Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/jackson-converter-enhancements.md Demonstrates creating a custom JacksonConverter using a Scala partial function. This allows defining conversion logic for different input types, such as strings or maps, to a target Scala type. ```scala import com.tjclp.fastmcp.core.JacksonConverter // Assuming MyType is a defined case class or type // case class MyType(...) // Create converter from partial function val myConverter = JacksonConverter.fromPartialFunction[MyType] { case str: String => MyType.parse(str) case map: Map[String, Any] => MyType.fromMap(map) } ``` -------------------------------- ### Derive Scala Converter for Case Classes Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/jackson-converter-enhancements.md Demonstrates using the `DeriveJacksonConverter` macro to automatically generate a JacksonConverter for Scala case classes. This significantly reduces boilerplate code for common data structures. ```scala import com.tjclp.fastmcp.macros.DeriveJacksonConverter import com.tjclp.fastmcp.core.JacksonConverter case class Person(name: String, age: Int) given JacksonConverter[Person] = DeriveJacksonConverter.derived[Person] ``` -------------------------------- ### Transform Input Before Scala Conversion Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/jackson-converter-enhancements.md Illustrates how to transform input data before it is processed by a JacksonConverter. The `contramap` function allows modifying the input value, such as converting a string to lowercase, before the main conversion logic is applied. ```scala import com.tjclp.fastmcp.core.JacksonConverter // Assuming existingConverter is a JacksonConverter[SomeType] // val existingConverter: JacksonConverter[SomeType] = ... // Transform input before conversion val transformingConverter = existingConverter.contramap[String](_.toLowerCase) ``` -------------------------------- ### Add Custom Jackson Module to Converter Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/jackson-converter-enhancements.md Shows how to integrate a custom Jackson module into the JacksonConverter. This is useful for registering custom serializers, deserializers, or type modifiers with Jackson. ```scala import com.tjclp.fastmcp.core.JacksonConverter import com.fasterxml.jackson.databind.Module // Assuming myCustomModule is an instance of com.fasterxml.jackson.databind.Module // val myCustomModule: Module = ... // Add custom Jackson module val withModule = JacksonConverter.withCustomModule[MyType](myCustomModule) ``` -------------------------------- ### Derive Scala Converter for Nested Collections Source: https://github.com/tjc-lp/fast-mcp-scala/blob/main/docs/jackson-converter-enhancements.md Shows how automatic derivation handles nested collection types. When a case class contains collections of other types for which converters exist (either derived or custom), the converter for the outer type is automatically generated. ```scala import com.tjclp.fastmcp.macros.DeriveJacksonConverter import com.tjclp.fastmcp.core.JacksonConverter // Assuming Filter converter is defined as above // case class Filter(...) case class QueryFilters(filters: Seq[Filter]) // Automatically uses Seq[Filter] converter given JacksonConverter[QueryFilters] = DeriveJacksonConverter.derived[QueryFilters] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.