ShowToast displays a brief notification. It’s a client-side action — no server round-trip — so feedback is instant. Fire it directly from a button click, or use it as a CallTool callback to report success or failure after a server action completes.
Variants
Thevariant parameter controls the toast’s visual style. Omit it for a neutral default.
Description Text
Add a secondary line with thedescription parameter for toasts that need more context.
Duration
By default the host decides how long toasts persist. Override withduration (in milliseconds):
As CallTool Callbacks
The most common pattern: useShowToast as on_success and on_error callbacks on a CallTool to give feedback after a server action completes.
Wire these onto a CallTool with on_success and on_error. The {{ $error }} variable captures the error message from the server.
API Reference
ShowToast Parameters
str
required
Toast message text. Can be passed as a positional argument. Supports
{{ key }} interpolation.str | None
default:"None"
Optional secondary text displayed below the message.
"default" | "success" | "error" | "warning" | "info" | None
default:"None"
Visual style of the toast.
int | None
default:"None"
Auto-dismiss duration in milliseconds. When omitted, the host decides.
Protocol Reference
ShowToast