Interface ToolRequest

All Superinterfaces:
HasMeta, ServerFeature.Request

@Immutable public interface ToolRequest extends ServerFeature.Request
An incoming tool call request with the tool name, arguments, and metadata.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default Args
    Returns the arguments for this tool request.
    Creates a new builder for constructing ToolRequest instances.
    default void
    Validates that the tool name is not blank.
    @Nullable Map<String,Object>
    Returns the input response map from interactive tool calls, or null.
    @Nullable Map<String,Object>
    Returns the optional metadata map for protocol extensions.
    Returns the tool name.
    Returns the payload deserializer configured for this request, or null if not set.
    @Nullable ProgressToken
    The client's _meta.progressToken from this request, or null if the client did not opt into progress notifications for this call.
    @Nullable String
    Returns the request state string, or null.
    @Nullable Task
    The task handle for task-augmented tool calls, or null for non-augmented calls.
  • Method Details

    • name

      String name()
      Returns the tool name.
      Returns:
      the tool name
    • check

      @Check default void check()
      Validates that the tool name is not blank.
      Throws:
      IllegalArgumentException - if name is blank
    • arguments

      @Default default Args arguments()
      Returns the arguments for this tool request.
      Returns:
      the tool arguments, or empty if none provided
    • meta

      @Nullable Map<String,Object> meta()
      Description copied from interface: HasMeta
      Returns the optional metadata map for protocol extensions.
      Specified by:
      meta in interface HasMeta
      Returns:
      the metadata map, or null if none
    • payloadDeserializer

      @ExperimentalApi @Nullable PayloadDeserializer payloadDeserializer()
      Returns the payload deserializer configured for this request, or null if not set.

      Superseded by arguments(), which already carries the deserializer; this direct accessor may be removed once callers migrate off it.

      Returns:
      the payload deserializer, or null
    • progressToken

      @Nullable ProgressToken progressToken()
      The client's _meta.progressToken from this request, or null if the client did not opt into progress notifications for this call.
      Returns:
      the progress token, or null
    • inputResponses

      @Nullable Map<String,Object> inputResponses()
      Returns the input response map from interactive tool calls, or null.
      Returns:
      the input responses, or null
    • requestState

      @Nullable String requestState()
      Returns the request state string, or null.
      Returns:
      the request state, or null
    • task

      @Nullable Task task()
      The task handle for task-augmented tool calls, or null for non-augmented calls.
      Returns:
      the task handle, or null
    • builder

      static ToolRequest.Builder builder()
      Creates a new builder for constructing ToolRequest instances.
      Returns:
      a new builder