What it does
Find text in a site's draft: every page template, page stylesheet, the global stylesheet, partials and scripts. query is plain text (one line, at most 200 characters), case-insensitive unless case_sensitive is true. Each match names its file as patch_page does (file, path for a page's template or page_css, name for a partial or script), with the line, the column and that line trimmed. files narrows the search to some kinds. total counts every match and files counts them per file; matches holds the first limit (default 50, at most 200), and complete is false when there are more. version is the current draft version, which patch_page accepts as base_version.
Plans
Works on every plan: Free, Basic, Pro and Ultra.
Parameters
| Name | Type | About |
|---|---|---|
site_idrequired | string | The id of the site. list_sites gives the ids of your sites. |
queryrequired | string | The text to find, one line of at most 200 characters. |
files | array of one of: template, page_css, global_css, partial, script | Search only these kinds of file: template, page_css, global_css, partial, script. |
case_sensitive | boolean | true matches upper and lower case exactly. Default: case-insensitive. |
limit | integer | How many matches to return, from 1 to 200. Default 50. |
draft | string | Optional name of your own draft of this site (lowercase letters, digits and dashes, at most 40), such as "pricing-redesign". Each agent has its own drafts, so other agents' work never mixes into yours; give a name when you might work on this site from more than one chat at once, and use the same name on every read, write and publish of that piece of work. Without it you use your default draft. |
Example
Call search_draft with these arguments:
{
"site_id": "01a1…",
"query": "/old-pricing"
}
Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.
Related guides
- Find and change across pagesYour agent finds every place something is used and changes it in one go.
- Pages and partialsOne page per address, with shared headers and footers.