Interface AsyncToolFn

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface AsyncToolFn
Asynchronous tool function. Unlike ToolFn, apply(dev.tachyonmcp.api.runtime.InteractionContext, dev.tachyonmcp.api.server.features.tools.ToolRequest) does not throw checked exceptions — failures propagate through the returned CompletionStage, matching AsyncResourceFn and AsyncPromptFn.

Receives the full ToolRequest — call ToolRequest.arguments() for parsed Args, or read ToolRequest.progressToken() or ToolRequest.task() directly when needed.

Author:
Konstantin Pavlov
  • Method Details

    • apply

      CompletionStage<? extends ToolResult> apply(InteractionContext ctx, ToolRequest request)
      Executes the tool function asynchronously with the given request.
      Parameters:
      ctx - the interaction context
      request - the tool request containing arguments and metadata
      Returns:
      a future that completes with the tool result