Skip to main content

Exact order

onTransform -> onBeforeHandle -> tool.before -> middleware -> handler -> tool.after -> onAfterHandle -> mapResponse
                                                                                      ↓ (on throw)
                                                                                   onError

Success path

  1. raw params arrive
  2. onTransform can rewrite raw params
  3. schema parsing happens
  4. global onBeforeHandle runs
  5. tool-local before runs
  6. middleware chain runs
  7. handler runs
  8. tool-local after runs
  9. global onAfterHandle runs
  10. mapResponse runs

Failure path

If middleware or the handler throws:
  • tool-local after does not run
  • global onError runs
  • the error is returned through the transport path
  • onTransform for raw argument normalization
  • global hooks for cross-cutting observability
  • tool hooks for tool-specific side effects
  • middleware for execution control