Skip to main content

Overview

Tools let your AI agent do more than just answer questions. By registering tools, you give the agent the ability to perform actions on your website — add items to a cart, navigate to a page, look up account details, or anything else you can do with JavaScript. When a visitor asks something that requires an action, the agent automatically picks the right tool, passes the correct parameters, and returns the result in the conversation.

Register a tool

Use the registerTool method on your Zephlo instance:

Tool definition

Each tool has four fields:

Writing good descriptions

The description field is what the agent sees when deciding which tool to use. Be specific about when and why the tool should be called:

Input schema

The inputSchema follows JSON Schema format. Here are the supported types:

Example schema with all features

Add a description to every property. The agent uses these to understand what values to pass.

The execute function

The execute function runs in the browser when the agent calls the tool. It has full access to the DOM, localStorage, fetch, and any other browser API. Rules:
  • Must return a string (or Promise<string>)
  • Can be synchronous or asynchronous
  • The returned string is sent back to the agent as the tool’s result
Never return sensitive data (passwords, tokens, PII) from a tool. The result is sent to the AI agent and may appear in the chat.

Examples

Search products

Toggle dark mode

Get page context


Listening for tool results

You can listen for tool results to update your UI or trigger side effects:

Listing registered tools

Retrieve all registered tools and their schemas:

WebMCP browser integration

Zephlo implements the emerging WebMCP browser standard. When you register a tool, it’s also published to navigator.modelContext if the browser (or an agentic extension) supports it. Conversely, any tools other scripts have registered on navigator.modelContext are automatically discovered and made available to your agent. This means your tools can be shared with the visitor’s own AI assistant, and tools provided by other parts of your page work with Zephlo — no extra wiring. The standard API works everywhere regardless of browser support, so you don’t need to feature-detect it.

Next steps

Form tools

Turn HTML forms into tools with zero JavaScript.

Widget integration

Learn about embedding and customization options.