Interface ContentEncoder<T>

Type Parameters:
T - the type to encode

public interface ContentEncoder<T>
Encodes an object into MCP content.

Implementations of this interface can be registered to customize how tool results, prompts, and resources are encoded into MCP content.

  • Method Summary

    Modifier and Type
    Method
    Description
    encode(T object)
    Encode the given object into MCP content.
    Returns the type this encoder handles.
  • Method Details

    • encode

      ContentBlock encode(T object)
      Encode the given object into MCP content.
      Parameters:
      object - the object to encode
      Returns:
      the encoded content
    • getType

      Class<T> getType()
      Returns the type this encoder handles.
      Returns:
      the type this encoder handles