Set an element's action
set_actionGives one element on a page an action, like the Action row in an element's Settings in Xodia, on React (.tsx, .jsx) and plain HTML (.html) pages. Actions: addToCart (a button or link adds productId to the cart and opens it, with option for a product with options, like "Size: Large", and quantity for more than one), openCart (a button or link opens the cart), buyNow (a button or link goes straight to the payment page for productId through the shop, with option and quantity like addToCart and the cart left as it is; only on a site that still has the older Buy button's own files, address names that address instead), send (a form sends its fields to the site's thank-you-email feature; a button inside the form picks its form), none (removes the element's action). Find the element in file by text (its visible words or aria-label, whole and case-insensitive), id (its id attribute) or match (a piece of its opening tag exactly as written in the file, like className="buy" or <button id="add"); line narrows to the line its opening tag starts on. All given must point at the same single element: when they match none or more than one, nothing changes and the answer lists the lines to choose from. Only button and a elements (or a component such as Button or Link that passes data- attributes to its element) take cart and buy actions, and only a form takes send. Replaces the element's earlier action. Adds the site helper (xodia-interactions.js) to the site when it isn't there, which runs these attributes on every page. Read the file first; for many products use the shop kit's pieces (skill shop) instead of one button at a time.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file": "<file>",
"action": "<action>",
"projectId": "<projectId>"
},
"name": "set_action"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | The element's id attribute | |
| file | Yes | The page or component file the element is in, like src/routes/shop.tsx or index.html | |
| line | No | The line its opening tag starts on | |
| text | No | The element's visible words or aria-label | |
| match | No | A piece of the element's opening tag exactly as written in the file | |
| action | Yes | ||
| option | No | addToCart and buyNow: the choice for a product with options, every group: "Size: Large; Colour: Charcoal" (or JSON {"Size":"Large","Colour":"Charcoal"}); one value ("Large") for a product with one option group | |
| address | No | send: the feature's address (default from list_features); buyNow: only the older Buy button's own address, when there is no productId | |
| quantity | No | addToCart and buyNow: how many one click adds or buys (default 1) | |
| productId | No | addToCart and buyNow: the product's id (its slug in the Products collection) | |
| projectId | Yes | Project id from list_projects |