Hook Types
| Decorator | Timing | Use Case |
|---|---|---|
@Stage | Define execution stage | Custom flow steps |
@Will | Before stage executes | Pre-processing, validation |
@Did | After stage executes | Post-processing, logging |
@Around | Wraps stage execution | Caching, error handling |
FlowHooksOf
Create typed hook decorators for a specific flow:Available Flows
| Flow Name | Description |
|---|---|
tools:call-tool | Tool execution |
tools:list-tools | List tools |
resources:read-resource | Read resource |
resources:list-resources | List resources |
prompts:get-prompt | Get prompt |
prompts:list-prompts | List prompts |
http:request | HTTP request handling |
@Will (Before Hook)
Execute before a flow stage:Priority
Lower priority values execute first:Filter
Conditionally execute hooks:@Did (After Hook)
Execute after a flow stage:@Around (Wrapper Hook)
Wrap stage execution for full control:@Stage (Custom Stage)
Define custom flow stages:Hook Options
Registering Hooks
In Apps
In Plugins
Hook Context
Hooks receive flow context with access to:Error Handling
Errors in hooks are caught and logged:Full Example
Related
HookRegistry
Hook registry API
Flow Types
Flow type definitions
@Plugin
Create plugins
Customize Flows
Flow customization guide