# Guided tours for AI agents

**webmcp-tour** gives AI agents guided tours of your app, in one script tag. Any WebMCP agent can walk your users through it, highlighting and explaining each step. Declare a few targets when you want to shape the tour.

[Try the live demo](https://fboldo.github.io/webmcp-tour/demo/) · [Quick start](https://fboldo.github.io/webmcp-tour/quick-start.md) · [Tools reference](https://fboldo.github.io/webmcp-tour/tools.md)

![The Billing page of the demo app: the Change plan button is highlighted and a card beside it says "From the AI assistant" with the explanation and a Got it button.](https://fboldo.github.io/webmcp-tour/images/highlight-card.png)

It is a zero-dependency TypeScript library for the browser. It registers four [WebMCP](https://github.com/webmachinelearning/webmcp) tools on the page, so any agent that can call WebMCP tools (a browser's built-in assistant, an MCP client driving Chrome, or a model called from your own page script) can point at things.

The library is **experimental** (0.x): the API may change between minor versions, and WebMCP itself is still evolving. These docs describe the code in the repository as it is.

## Two ways to use it

**The zero-shot primitive.** Add one script tag. The agent calls `tour_list_targets` to read a visible outline of the page (headings, and controls with role, name and context), then `tour_show_step({ text: "Change plan", message: "…" })` to point at a control by its visible text. No markup, no configuration. This works on any page and is the way to start. See [Quick start](https://fboldo.github.io/webmcp-tour/quick-start.md).

**The declared map.** You tell the tour what your app has: targets (`data-tour-id`) with labels and descriptions, pages with URLs, and how to navigate. The agent then answers from your descriptions, can say "that control is on the Security page" and offer a **Go to Security** card, and the step **resumes** on the new page after the user presses Go. See [Concepts](https://fboldo.github.io/webmcp-tour/concepts.md).

| | Zero-shot | Declared map |
|---|---|---|
| Setup | A script tag | `data-tour-id` attributes, `pages`, `navigate` |
| The agent finds controls by | Visible text, accessible name, or a CSS selector | The same, plus ids you chose |
| Descriptions | Written by the agent each time | Written by you, shown by default |
| Other pages | Not known | Suggested with a card; resumes after Go |
| Best for | A quick start, a site you do not control | Your own product, where wording matters |

You can mix them freely: declared targets are an addition, not a mode.

## What the user sees

- A spotlight ring around the control, and a card beside it labelled **From the AI assistant** (so a page cannot pass the text off as its own) with a **Got it** button.
- Optionally **Take me there**, which scrolls to the control, focuses it and pulses the ring.
- For a control on another page: a card in the middle of the viewport, **Go to Security** or **Not now**, and nothing moves until the user picks.

The overlay uses system colours, supports light and dark, forced-colors and reduced motion, and is announced to screen readers ([Accessibility](https://fboldo.github.io/webmcp-tour/accessibility.md)).

## Where to go next

- [Quick start](https://fboldo.github.io/webmcp-tour/quick-start.md): a script tag, or a bundler.
- [Concepts](https://fboldo.github.io/webmcp-tour/concepts.md): targets, pages, the outline, resume, labels and placement.
- [Tools reference](https://fboldo.github.io/webmcp-tour/tools.md) and [Engine API](https://fboldo.github.io/webmcp-tour/engine-api.md): exact inputs and results.
- [Agent hosts](https://fboldo.github.io/webmcp-tour/agent-hosts.md): Playwright MCP, Chrome, and in-page agents.
- [FAQ](https://fboldo.github.io/webmcp-tour/faq.md): how this differs from browser agents, size, SSR.
