Interface ToolResponseEncoder<TYPE>

Type Parameters:
TYPE -

public interface ToolResponseEncoder<TYPE>
Encodes an object as ToolResponse.

If a tool response encoder exists and matches a specific return type then it always takes precedence over matching ContentEncoder.

Implementation classes must be CDI beans. Qualifiers are ignored. Dependent beans are reused during encoding.

Encoders may define the priority with Priority. An encoder with higher priority takes precedence.

See Also:
  • ToolResponse
  • Tool
  • Method Summary

    Modifier and Type
    Method
    Description
    org.mcpjava.server.tools.ToolResponse
    encode(TYPE value)
    Encodes the given business object into the target type
    Returns the type handled by this encoder.
  • Method Details

    • getType

      Class<TYPE> getType()
      Returns the type handled by this encoder.
      Returns:
      the class of objects this encoder can encode, must not be null
    • encode

      org.mcpjava.server.tools.ToolResponse encode(TYPE value)
      Encodes the given business object into the target type
      Parameters:
      value -
      Returns:
      the encoded value