Understand Path Patterns

Restrict a tool to specific pages on your site.

Why path patterns matter

If you register an addToCart tool on your site, it shouldn't appear when an AI agent visits your /contact page. Path patterns let you scope tools to where they make sense.

Path patterns scope a tool by page. There's a separate Allowed origins field that scopes a tool by frame instead, see Write Tools by Hand for what that's actually useful for.

Setting a path pattern

In the tool form, the Page path field accepts a pattern. Leave it blank to show the tool on all pages.

Pattern syntax

PatternMatchesDoesn't match
(blank)All pages—
/contact/contact exactly/contact/us
/products/*/products/shoes/products/shoes/detail
/products/**/products/shoes, /products/shoes/detail/blue/other/shoes
/blog/[slug]/blog/hello-world/blog/hello/extra
  • * matches exactly one URL segment (no slashes)
  • ** matches any number of segments (including slashes)
  • [param] is dynamic segment syntax, treated as a single-segment wildcard (same as *)

Real-world examples

E-commerce product page:

/products/*

Matches /products/shoes-01, /products/jacket-blue. One product per URL.

Blog section:

/blog/**

Matches /blog, /blog/2026/my-post, /blog/category/tech/post. Any depth.

Exact contact page:

/contact

Only matches /contact, not /contact-us or /contact/form.

How the snippet uses path patterns

The snippet passes window.location.pathname to the config endpoint on every load:

GET /api/sites/YOUR_ID/config?path=/products/shoes-01

The server returns only tools whose pattern matches that path (or tools with no pattern).

Pages where nothing may run

A path pattern says where one tool may run. It can't say "never here", and one snippet install covers a whole site, so there was no way to keep tooling off a page entirely. Excluded pages on the site page does that.

List one path per line. Each entry covers everything beneath it, so /checkout also excludes /checkout/payment — you don't have to remember the second line, which is exactly the page you'd least want left running. Sibling paths are safe: /checkout does not touch /checkout-help.

On an excluded page the server returns no tools at all and marks the response disabled, so the snippet stops: nothing registers, nothing polls, no calls are recorded. It's enforced server-side rather than in the snippet, so tool code is never delivered to a page you've ruled out.

Checkout is the usual first entry. Anything handling payment or personal data is a reasonable second.

Already-open pages keep whatever they registered until their next config poll, so allow up to five minutes for a change to take effect everywhere.

Verifying your pattern

Use the config endpoint directly to check which tools are returned for a given path:

https://aigentably.com/api/sites/YOUR_PUBLIC_ID/config?path=/products/test

Check the tools array in the response. An excluded path comes back as {"tools": [], "disabled": true}.