Skip to main content
CallHandler invokes a client-side JavaScript function registered by the app developer. Where CallTool crosses the network to your server, CallHandler runs instantly in the browser — ideal for state transformations like constraint enforcement, computed fields, or domain-specific logic that doesn’t need server involvement.
Handlers are registered via js_actions on PrefabApp. See Custom Handlers for how to write and register them.

Passing Arguments

Use arguments to pass extra data to the handler. Values support {{ }} interpolation, so you can pass client state at call time:
The handler receives these via ctx.arguments:

Handling Results

The handler’s return value is available as $result in on_success callbacks, just like CallTool:
If the handler throws an exception, on_error fires with the error message in $error.

Combined with Other Actions

Chain CallHandler with other actions in a list:

API Reference

CallHandler Parameters

str
required
Name of the registered handler function. Can be passed as a positional argument.
dict[str, Any] | None
default:"None"
Extra arguments passed to the handler via ctx.arguments. Values support {{ key }} interpolation.
Action | list[Action] | None
default:"None"
Action(s) to run when the handler returns. The return value is available as $result.
Action | list[Action] | None
default:"None"
Action(s) to run when the handler throws. The error message is available as $error.

Protocol Reference

CallHandler
For the complete protocol schema, see CallHandler.