NAME
Langertha::Role::ToolResultPDF - Role for an engine whose tool results carry PDFs the model reads
VERSION
version 0.504
SYNOPSIS
if ( $engine->supports('tool_result_pdf') ) {
# a PDF a tool returns reaches the model as a document it reads
}
else {
# it becomes a text placeholder:
# "[resource] application/pdf <file:///docs/report.pdf> (12345 bytes)"
}
DESCRIPTION
Composing this role gives the engine the tool_result_pdf capability: a PDF a tool returns (an MCP embedded resource whose blob is application/pdf) reaches the model as a native document it reads, in the tool-result form of this engine's tool_wire_format: an Anthropic document block, an Open Responses input_file part, a Gemini functionResponse.parts[].inlineData ("DESCRIPTION" in Langertha::ToolResult). Without the flag the PDF goes out as the text placeholder. "format_tool_results" in Langertha::Role::Tools reads the flag.
"engine_capabilities" in Langertha::Role::Capabilities keeps the flag only while the engine's current tool_wire_format has a native tool-result PDF form ("carries_native" in Langertha::ToolResult). Whether the model must also see images is a fact of that wire ("native_needs_vision" in Langertha::ToolResult), so it holds for an engine forced onto the wire too:
the
anthropicwire reads a PDF without vision (a text-only model gets the extracted text), so there the flag does not needimage_input; the Anthropic family ties it to whether the endpoint takes Anthropic's source blocks inside atool_resultinstead;on the
responsesandgeminiwires PDF understanding is a vision feature (OpenAI and Gemini document it so), so the flag needsimage_inputthere (Gemini: Gemini 3 and later only).
Perplexity's Agent API shares the Responses envelope but has no input_file in a function call output, so it does not compose this role (ADR 0039).
The role has no attributes or methods.
SEE ALSO
Langertha::Role::Capabilities - The
tool_result_pdfflagLangertha::Role::ToolResultImages - The same for an image
Langertha::ToolResult - The per-wire tool-result forms
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.