Install
Works with Drupal: ^10.5 || ^11Using Composer to manage Drupal site dependencies
Alternative installation files
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
OutputDefinitionInterfaceyourself.
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.
InputDefinitionInterfaceandOutputDefinitionInterfacenow extendDataDefinitionInterfaceonly.instanceof ContextDefinitionInterfaceand the core context definition classes no longer match Tool definitions. To mean "one of ours", checkinstanceof MapDefinitionBase,ListDefinitionBase, or the entity definition classes.getDataDefinition()andisSatisfiedBy()are gone from the definitions.
- Input and output values are stored as typed data, not
Contextobjects.getInput(),setInput(),getInputs(),getOutput()andgetOutputs()are removed. Use the value accessors (getInputValue(),getInputValues(),setInputValue(),getOutputValue(),getOutputValues(),setOutputValue()), orgetInputData()/getOutputData()when you need the typed data object.getConfigurationValue($name, TRUE)now returns typed data.
MapContextDefinitionandListContextDefinitionare removed. UseMapInputDefinition/MapOutputDefinitionandListInputDefinition/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.
- A core context definition fails with a
$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
- A required list may be empty, for inputs and outputs, but may not be
NULL. An input declared asInputDefinition('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, orNotBlankwithoutallowNull, now rejects[]. This is the intended contract for required list inputs. #3583062 will apply the rule to every required list input and advertise it asminItems: 1. To require at least one item today, declare aCountconstraint, which is advertised asminItems.
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:userinput 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.siteuse 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
Countthey enforce, asminItems/maxItems. - A converted multiple input reaches transform subscribers as one list-typed event, instead of item-typed events with
multipleset.tool:inforeports it aslist. - 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
getFormattedResult() now sends each value in the format its advertised schema describes:
timestamp(core 11.1 and later):1785606907becomes"2026-08-01T17:55:07+00:00".decimal:19.99becomes"19.99".datetime_iso8601with theDateTimeconstraint:"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 toolis 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 holdadminister toolkeep 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: TRUEon 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
ListInputDefinitionorListOutputDefinitionwith anitem_definitioninstead.Countstays 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 Schemaexampleskeyword the way inputs' examples are (#3583038). ToolDefinitionSerializer::normalizeOutputSchema()returns the complete output schema, with the object wrapper andrequired, as the twin ofnormalizeInputSchema()(#3583033).
Drush
tool:info --format=jsonincludesinput_schemaandoutput_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:listandtool:searchshow requirement status.tool:listandtool:searchaccept--unmet=show|hide|only(#3583025).tool:listandtool:searchaccept--format=json(#3583036).tool:runvalidates inputs before it checks access, and reports the two failures separately. The reason for an access denial is included. With--json, every failure carries anerror_type(#3582991).- When
tool:runis denied access and--uidwas omitted, the message says the command ran as anonymous (uid 0) and names the option. An explicit--uid=0keeps the plain message (#3583044).
Agent skills
- A new
use-drupal-toolsskill walks agents through finding, inspecting and running tools from the CLI (#3583012). - The
create-tool-pluginsskill moved to.agents/skills/, wheredrupal/ai_best_practicesfinds 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 aftersetInputValue(). 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 callvalidateInputs()first to tell the two apart (#3583031).
Bug fixes
- Constraints declared on a
ListInputDefinition, such asCount, 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=jsonprintsinputsandoutputsas{}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: TRUEand the output acceptance shim are removed (#3583049, #3583050). Convert them during the beta. - A required list input will reject
[]and advertiseminItems: 1(#3583062). - Declared
Counton list outputs, and other output-side constraints, will be validated (#3583056).
Contributors
Thanks to @aivazashvilit, @dries, @kotekirkitadze, @mglaman, @michaellander and @scottfalconer.
```