类 DefaultToolResultConverter

java.lang.Object
io.agentscope.core.tool.DefaultToolResultConverter
所有已实现的接口:
ToolResultConverter

public class DefaultToolResultConverter extends Object implements ToolResultConverter
Default implementation of ToolResultConverter. Handles JSON serialization with schema information.

This converter:

  • Converts null results to "null" text
  • Converts void results to "Done" text
  • Passes through ToolResultBlock instances unchanged
  • Serializes objects to JSON with schema information
  • Falls back to toString() if serialization fails
  • 构造器详细资料

    • DefaultToolResultConverter

      public DefaultToolResultConverter()
  • 方法详细资料

    • convert

      public ToolResultBlock convert(Object result, Type returnType)
      从接口复制的说明: ToolResultConverter
      Convert tool call result to ToolResultBlock.
      指定者:
      convert 在接口中 ToolResultConverter
      参数:
      result - the tool call result (may be null)
      returnType - the return type of the tool method (may be null)
      返回:
      ToolResultBlock containing the converted result (never null)
    • handleNull

      protected ToolResultBlock handleNull()
      Handle null result.
      返回:
      ToolResultBlock with "null" text
    • handleVoid

      protected ToolResultBlock handleVoid()
      Handle void return type.
      返回:
      ToolResultBlock with "Done" text
    • serialize

      protected ToolResultBlock serialize(Object result, Type returnType)
      Serialize result to JSON string with schema.
      参数:
      result - the result to serialize
      returnType - the return type
      返回:
      ToolResultBlock with JSON string and schema