Learn how to implement client-side tools in Ultravox to create dynamic, interactive user interfaces.
Define the Tool
Implement Logic
Register the Tool
Create the UI
/final
folder in the repo to get final versions of the various files you will create or edit.updateOrder
tool that the AI agent will use to modify the order display.
Modify .demo-config.ts
:
updateOrder
and describes what it does and how to use it.orderDetailsData
that:
name
, quantity
, specialInstructions
, and price
. Only specialInstructions
is optional.sysPrompt
variable:
selectedTools
to our call definition and update our import statement.
Add the tool to your demo configuration:
ParameterLocation
and SelectedTool
to our import:
updateOrder
tool, we need to implement the logic for it.
Create /lib/clientTools.ts
to handle the tool’s functionality:
/lib/callFunctions.ts
:
/components/OrderDetails.tsx
:
page.tsx
) to include the new component:
http://localhost:3000