Documentation

test_custom_event_rule

Checks a CSS selector against the store's stored DOM snapshots and reports how many elements it matches, per page, before you create a rule.

When to use it

Always, before create_custom_event_rule. It is the pre-flight check that stops a broken selector from being deployed to the storefront.

Ask for it like this

You do not name the tool. These are questions that make an assistant reach for it:

Does .size-chart-btn actually match anything on my product pages?

How to read the result

  • Supports tag, .class and #id compound selectors with descendant combinators, for example 'form button.primary' or '.product-page .size-chart'.
  • Sibling, attribute and pseudo-class selectors are not testable against snapshots, but may still work at runtime. The response says which case you are in.
  • Zero snapshots is a different answer from zero matches, and the response distinguishes them.

Parameters

cssSelector
stringrequired
The selector to test.
pageUrlPattern
string
Restrict the test to pages whose URL matches this SQL LIKE pattern.

Shared parameters it accepts

None. This tool is not date-scoped — it reports current state rather than a window.

Every tool also accepts merchantId, which resolves from your connection. You never pass it.

What comes back

JSON. These are the top-level keys; date-scoped tools additionally carry a _meta block with the server date and the data coverage envelope.

success
false when the selector is invalid or untestable, with the reason in error.
totalMatches
Elements matched across all snapshots checked.
snapshotsChecked
How many stored page snapshots were searched.
pagesWithMatches
How many distinct pages contained a match.
matches
Match counts per page.

Pairs with