Skip to main content
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

The variant parameter controls the toast’s visual style. Omit it for a neutral default.

Description Text

Add a secondary line with the description parameter for toasts that need more context.

Duration

By default the host decides how long toasts persist. Override with duration (in milliseconds):

As CallTool Callbacks

The most common pattern: use ShowToast 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
For the complete protocol schema, see ShowToast.