Install

Works with Drupal: ^10.5 || ^11

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 507.85 KB
MD5: a93e61c340ba6091e3eeb59420c0f454
SHA-1: 0f34ab422a13b6de5560f62ad960270c421275f5
SHA-256: 83412b4152a99902f72eb280762b2903e571914193305eac07e3c0e5f97e9f2d
Download zip 689.54 KB
MD5: 01073485128b884492f9931173244591
SHA-1: c0d5587b691a70f0654c880a7950ce3a152307ff
SHA-256: 5a29de2e7b22cc16ca5e16fb60dc5fab40663ceb2578fbe42d7cf19972076471

Release notes

Here's the full HTML, ready to paste into the drupal.org release form:

```html

This release finishes detaching input and output definitions from core's context system, deprecates multiple: TRUE in favor of explicit list definitions, and makes output values match the JSON Schema that is advertised for them.

It contains breaking changes. Read the upgrade notes before updating, especially if you:

  • extend the definition classes;
  • call the removed context accessors;
  • construct list definitions with positional arguments;
  • implement OutputDefinitionInterface yourself.

Upgrade notes

Definitions are no longer context definitions

Issues: #3583017, #3583018, #3583019

This change was deprecated and removed within this release window, so no tagged release carried the deprecations. Coming from beta9, it is a direct break.

  • InputDefinitionInterface and OutputDefinitionInterface now extend DataDefinitionInterface only.
    • instanceof ContextDefinitionInterface and the core context definition classes no longer match Tool definitions. To mean "one of ours", check instanceof MapDefinitionBase, ListDefinitionBase, or the entity definition classes.
    • getDataDefinition() and isSatisfiedBy() are gone from the definitions.
  • Input and output values are stored as typed data, not Context objects.
    • getInput(), setInput(), getInputs(), getOutput() and getOutputs() are removed. Use the value accessors (getInputValue(), getInputValues(), setInputValue(), getOutputValue(), getOutputValues(), setOutputValue()), or getInputData() / getOutputData() when you need the typed data object.
    • getConfigurationValue($name, TRUE) now returns typed data.
  • MapContextDefinition and ListContextDefinition are removed. Use MapInputDefinition / MapOutputDefinition and ListInputDefinition / ListOutputDefinition.
  • Map properties and list items only accept definitions of their own family:
    • A core context definition fails with a TypeError.
    • An output definition inside an input list or map, or the reverse, throws an InvalidArgumentException (#3583051). An input definition used as a list item or map property of an output, or the reverse, used to be accepted and ignored.
    • The single-property setPropertyDefinition() is checked the same way.

$multiple constructor parameter removed from list definitions

Issue: #3583049

ListInputDefinition and ListOutputDefinition no longer take $multiple. Positional callers shift by one argument and fail with a TypeError. Use named arguments.

Custom output definition classes need examples

OutputDefinitionInterface gains getExamples() and setExamples(). A class that implements the interface without extending one of the provided output classes must add them, or use Drupal\tool\TypedData\ExamplesTrait.

Required outputs are enforced

Issue: #3583029

ToolBase::execute() now fails a tool that declared a required output and left it unset or NULL. That was always the declared contract, but such tools used to succeed. Output values are now validated by shape, the same way inputs are. Validation no longer runs the full entity and field validation on a loaded entity.

Empty lists and maps

Issues: #3583040, #3583049

  • A required list may be empty, for inputs and outputs, but may not be NULL. An input declared as InputDefinition('list', ...) now accepts [].
  • A required map still rejects []. A tool whose free-form map output can be empty should declare that output optional.
  • A multiple input converted to a list (see Deprecations) that declared NotNull, or NotBlank without allowNull, now rejects []. This is the intended contract for required list inputs. #3583062 will apply the rule to every required list input and advertise it as minItems: 1. To require at least one item today, declare a Count constraint, which is advertised as minItems.

Entity inputs

Issue: #3583028

  • An entity input accepts any EntityInterface, so config entities such as roles now satisfy their entity type.
  • The declared entity type and bundle are checked during validation. A node passed to an entity:user input is now a violation that names the input, instead of a failure inside the tool.
  • Map inputs accept integer property names. Config objects such as system.site use them.

Advertised schemas

  • A multiple definition keeps its own label and description on the array. It no longer produces an "Array of <label>" description with the text moved onto items (#3583041).
  • Under invokers that pass entities as handles, an entity list's handle note moves from the array description to items.description. The generated "Entity" and "Entity handle" item titles are no longer emitted.
  • A multiple input with a default no longer advertises items.default.
  • Entity handle lists now advertise the Count they enforce, as minItems / maxItems.
  • A converted multiple input reaches transform subscribers as one list-typed event, instead of item-typed events with multiple set. tool:info reports it as list.
  • Under ai_agents' force_value, a hand-declared list now takes the first value, which is what a multiple input always did.

Output values match their schemas

Issues: #3583030, #3583035

getFormattedResult() now sends each value in the format its advertised schema describes:

  • timestamp (core 11.1 and later): 1785606907 becomes "2026-08-01T17:55:07+00:00".
  • decimal: 19.99 becomes "19.99".
  • datetime_iso8601 with the DateTime constraint: "2026-08-01T12:35:07" becomes "2026-08-01T12:35:07+00:00".
  • An empty map: [] becomes {}.

getResult(), getOutputValue() and getOutputValues() still return the PHP values. drush tool:run now prints the formatted values.

Permissions

Issue: #3582967

  • administer tool is now marked restricted.
  • A new restricted permission, view tool information, grants read-only access to the Tool Explorer's listing and tool pages.
  • Executing a tool from the Tool Explorer still requires administer tool, and roles that hold administer tool keep all of their access.

tool_ai_connector

  • The unused hook_ai_tools_property_alter() implementation (AiToolsPropertyHooks) is removed (#3583021). The schema property converter already advertises nested maps and lists.
  • The connector now adapts Tool definitions at the ai module boundary.

Deprecations

multiple: TRUE (#3583049):

  • Declaring multiple: TRUE on a top-level input, a top-level output or a map property converts it to an explicit list definition and triggers a deprecation. A refiner that returns a multiple definition triggers it too.
  • The conversion is removed in 1.0.0-rc1, together with #3583050.
  • Declare a ListInputDefinition or ListOutputDefinition with an item_definition instead. Count stays on the list; every other constraint belongs on the item.
  • The advertised schema of a converted definition is unchanged. The one exception is the empty-array rule in the upgrade notes above.

Declaring a core context definition, or an input definition, as an output has been deprecated since beta9 and is also removed in 1.0.0-rc1 (#3583050).

New features

Tool icons

Issue: #3562612

#[Tool(icon: 'pack_id:icon_id')] references an icon from the core Icon API (Drupal 11.1 and later). ToolDefinition::getIcon() returns the reference. The Tool Explorer renders the icon, or an icon for the tool's operation when none is set. Derivers can set an icon per derivative. On older cores the icon is ignored.

Output examples and output schema

  • Output definitions accept examples, emitted as the JSON Schema examples keyword the way inputs' examples are (#3583038).
  • ToolDefinitionSerializer::normalizeOutputSchema() returns the complete output schema, with the object wrapper and required, as the twin of normalizeInputSchema() (#3583033).

Drush

  • tool:info --format=json includes input_schema and output_schema. The table and markdown formats gain a Constraints column and one row per map property. The commands pass a Drush invoker (#3583023).
  • tool:info, tool:list and tool:search show requirement status. tool:list and tool:search accept --unmet=show|hide|only (#3583025).
  • tool:list and tool:search accept --format=json (#3583036).
  • tool:run validates inputs before it checks access, and reports the two failures separately. The reason for an access denial is included. With --json, every failure carries an error_type (#3582991).
  • When tool:run is denied access and --uid was omitted, the message says the command ran as anonymous (uid 0) and names the option. An explicit --uid=0 keeps the plain message (#3583044).

Agent skills

  • A new use-drupal-tools skill walks agents through finding, inspecting and running tools from the CLI (#3583012).
  • The create-tool-plugins skill moved to .agents/skills/, where drupal/ai_best_practices finds it.
  • Both skills now teach list definitions instead of multiple.

Documentation

  • The access() contract is written down. It answers whether an account may run the tool with the values currently set, so its answer can change after setInputValue(). It is not an answer to "may this account use this tool at all". A denial can mean the account may not run the tool, or that the inputs are invalid, so call validateInputs() first to tell the two apart (#3583031).

Bug fixes

  • Constraints declared on a ListInputDefinition, such as Count, are validated. They were silently ignored before (#3583048).
  • A structure-reading constraint on a map input, such as ComplexData, validates the map's properties. It used to throw (#3583060).
  • An input list or map ignored an output definition used as an item or property. It is now rejected (#3583051).
  • tool:info --format=json prints inputs and outputs as {} for a tool that has none. They were [], unlike the object a tool with inputs gets (#3583045).
  • See the upgrade notes for #3583029, #3583030, #3583035, #3583040, #3583041 and #3583028.

Coming next

  • Tools will be able to declare the permission they require, checked before input validation and usable to filter tool listings (#3583064).
  • In 1.0.0-rc1, multiple: TRUE and the output acceptance shim are removed (#3583049, #3583050). Convert them during the beta.
  • A required list input will reject [] and advertise minItems: 1 (#3583062).
  • Declared Count on list outputs, and other output-side constraints, will be validated (#3583056).

Contributors

Thanks to @aivazashvilit, @dries, @kotekirkitadze, @mglaman, @michaellander and @scottfalconer.

```

Created by: michaellander
Created on: 27 Sep 2026 at 23:02 UTC
Last updated: 27 Sep 2026 at 23:02 UTC
Bug fixes
New features

Other releases