NAME

Langertha::Role::ToolResultImages - Role for an engine whose tool results carry images the model sees

VERSION

version 0.504

SYNOPSIS

# Which representation a tool's image gets in the tool loop:
if ( $engine->supports('tool_result_images') ) {
    # the image reaches the model as an image part
}
else {
    # it becomes a text placeholder: "[image] image/png (12345 bytes)"
}

# Composed by an engine whose tool-result wire form takes an image:
package My::Engine;
use Moose;
extends 'Langertha::Engine::AnthropicBase';
with 'Langertha::Role::ToolResultImages';

DESCRIPTION

Composing this role gives the engine the tool_result_images capability: an image a tool returns (an MCP image block, or an embedded resource whose blob is an image) reaches the selected model as an image it sees, in the tool-result form of this engine's tool_wire_format (Langertha::ToolResult's image_input option). Without the flag the image goes out as the text placeholder that names its type, MIME type and size. "format_tool_results" in Langertha::Role::Tools reads the flag and nothing else.

Like image_input, the flag is model-scoped. The composed role says the engine's endpoint documents an image inside a tool result; "engine_capabilities" in Langertha::Role::Capabilities then keeps the flag only while

  • the selected model claims image_input -- a probed or imported image_input fact (ADR 0032) counts, and

  • the engine's current tool_wire_format has a native tool-result image form at all ("carries_native" in Langertha::ToolResult: anthropic, responses, gemini), so an engine forced onto another wire loses it.

Engines refine it per model or per endpoint like any other flag (Gemini grants it to Gemini 3 and later only; AKI.IO's /anthropic shim clears it, because its models do not see an image inside a tool_result).

The tool loop sends what an MCP server returned, not what the caller chose, so a false claim is not harmless: the provider may reject the turn, or accept it while the model never sees the image. Engines claim it only where the provider's documentation (or a live probe) shows the form works (ADR 0039).

The role has no attributes or methods.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.