Class ToolRegistry

java.lang.Object
io.micronaut.mcp.server.registry.ToolRegistry

@Singleton @Internal public final class ToolRegistry extends Object
The registry of Tools.
  • Field Details

  • Method Details

    • getSyncSpecs

      public List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification> getSyncSpecs()
    • getAsyncSpecs

      public List<io.modelcontextprotocol.server.McpServerFeatures.AsyncToolSpecification> getAsyncSpecs()
    • getStatelessSyncSpecs

      public List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification> getStatelessSyncSpecs()
    • getStatelessAsyncSpecs

      public List<io.modelcontextprotocol.server.McpStatelessServerFeatures.AsyncToolSpecification> getStatelessAsyncSpecs()
    • isNotEmpty

      public boolean isNotEmpty()
    • addMethod

      public final void addMethod(io.micronaut.inject.BeanDefinition<?> beanDefinition, io.micronaut.inject.ExecutableMethod<?,?> method)
      Adds a new method to the registry by associating it with a given bean definition.
      Parameters:
      beanDefinition - the bean definition that declares or provides the method
      method - the executable method to be added to the registry
    • drainMethods

      protected final Stream<io.micronaut.mcp.server.registry.AbstractMcpMethodRegistry.Method<Object>> drainMethods()
      Returns a stream of the methods currently stored in the registry. After the stream is consumed or closed, the underlying list of methods will be cleared.
      Returns:
      a stream of methods from the registry
    • mcpError

      protected io.modelcontextprotocol.spec.McpError mcpError(Exception ex)
    • prepareBoundVariables

      protected Map<io.micronaut.core.type.Argument<?>,Object> prepareBoundVariables(io.micronaut.inject.ExecutableMethod<?,?> executable, List<?> parameters)
    • resolveMcpTransportContext

      @Nullable protected @Nullable io.modelcontextprotocol.common.McpTransportContext resolveMcpTransportContext(Object ctx)