convertResult

fun convertResult(result: Any?, objectMapper: <Error class: unknown class>): Tool.Result

Converts a method return value to a Tool.Result.

  • null → empty text result

  • String → text result

  • Tool.Result → returned as-is

  • anything else → serialised to JSON with the original object as an artifact, so that artifact-sinking decorators can capture it for tool chaining