For developers¶
The Tool module is a plugin type. You extend it by writing tool plugins in your own module, and you integrate with it by discovering and running those plugins through the tool manager.
Extension points¶
- Tool plugins. Define a tool by adding a class under
src/Plugin/tool/Tool/with the#[Tool]attribute, extendingToolBase. See Creating a tool. - Typed data adapters. The type system that maps input and output definitions to
form elements and config schema is itself a plugin type,
Plugin/tool/TypedData/Adapter/. Add an adapter to support a new data type. See Input and output definitions. - Events. Subscribe to input and output transform events to change values based on the invoker, and to normalize events to change how definitions are serialized. See Events.
Core services¶
| Service | Purpose |
|---|---|
plugin.manager.tool |
Discovers, instantiates, and runs tool plugins. |
plugin.manager.tool.typed_data_adapter |
Maps data definitions to adapters. |
tool.handle_store |
Stores and resolves opaque handles for values. |
tool.entity_handle_transformer |
Swaps entities for handles and back. |
tool.definition_serializer |
Serializes tool definitions. |
The tool lifecycle¶
- A caller asks
plugin.manager.toolfor a tool instance, optionally passing an invoker identifier. - The caller sets input values. Each
setInputValue()dispatches aToolInputTransformEvent, so subscribers can transform the value for the invoker before it is stored. - The caller calls
execute(). The tool validates inputs, runs itsdoExecute()logic, and captures anExecutableResult. - The caller reads the result.
getResult()returns the raw result;getFormattedResult()applies per output transforms and returns aFormattedExecutableResultready for the invoker.
The invoker is the key idea: the same tool produces raw values for a deterministic caller and transformed, handle backed values for an AI or remote caller, without the tool's own code branching on the caller.