qr_tool
No security coverage
A lightweight QR code builder for Drupal. Takes a link as input, generates a PNG on the file system using the endroid/qr-code library, and returns the absolute URL of the saved image.
The image is written to public://qr-codes/qr-{hash}.png as a managed Drupal file, with a stable filename per (link, size) so repeated calls reuse the same file instead of multiplying them.
Requirements
- Tool - the plugin API this module exposes a tool through.
endroid/qr-code^6.0 - pulled in automatically via Composer.
Install
composer require drupal/qr_tool drush en qr_tool
Then grant the Generate QR codes via tool permission to whichever role or agent should be allowed to invoke the tool.
Inputs
Name Type Required Descriptionlink
string
yes
URL or text to encode into the QR code.
size
integer
no
Edge length in pixels. Defaults to 300; clamped to the range50–1000.
Output
The tool returns:
url- absolute URL to the generated PNG.file_uri- thepublic://...stream URI.fid- managed file ID.size- the rendered edge length in pixels.
Where it fits
qr_tool is a single Tool plugin, so anything that speaks the Tool API can call it:
- External coding agents (Claude Code, Cursor, Codex, etc.) via an MCP bridge or any HTTP transport that exposes Drupal tools.
- Drupal AI Agents - add the tool to an agent's allowed-tool list and prompt it with phrases like “generate a QR code for this URL”.
- FlowDrop - drop the tool into a flow step to mint a QR for any URL produced earlier in the flow.
- ECA - install ECA Tool and the QR tool becomes available as an ECA action, so you can generate QR codes from any ECA event (node save, webform submission, cron, etc.) without writing code.
- Trigger it manually in three lines of code.