🔧 Client Tools Demo

Demonstrates registering and using client-side tools with the TTP Chat Widget

📝 How to Test

Waiting to initialize widget...

📦 Registered Tools

get_url

Description: Returns the current page URL

Returns: { url: string }

Example: Ask the agent "What is the current URL?" or "Where am I?"

move_to_contact_page

Description: Navigates the browser to the contact page

Returns: { success: true, message: string }

Example: Ask the agent "Take me to the contact page" or "Go to contact"

Code Example:

// Register get_url tool
widget.registerClientTool('get_url', async (params) => {
  return { url: window.location.href };
});

// Register move_to_contact_page tool
widget.registerClientTool('move_to_contact_page', async (params) => {
  window.location.href = 'https://talktopc.com/contact';
  return { success: true, message: 'Navigating to contact page...' };
});