Skip to main content
Glama

Set an element's action

set_action
Destructive

Gives 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

NameRequiredDescriptionDefault
idNoThe element's id attribute
fileYesThe page or component file the element is in, like src/routes/shop.tsx or index.html
lineNoThe line its opening tag starts on
textNoThe element's visible words or aria-label
matchNoA piece of the element's opening tag exactly as written in the file
actionYes
optionNoaddToCart 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
addressNosend: the feature's address (default from list_features); buyNow: only the older Buy button's own address, when there is no productId
quantityNoaddToCart and buyNow: how many one click adds or buys (default 1)
productIdNoaddToCart and buyNow: the product's id (its slug in the Products collection)
projectIdYesProject id from list_projects

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the annotations: discloses that it 'Replaces the element's earlier action' (matching destructiveHint=true), that it installs the site helper xodia-interactions.js when absent (a project-wide side effect on every page), and that ambiguous locators are a no-op that returns candidate lines. Also states element-type preconditions ('only button and a elements ... take cart and buy actions, and only a form takes send'), which annotations cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and locator rules are front-loaded, but the body is a single dense paragraph of run-on clauses and stacked parentheticals (action definitions, element constraints, helper-script side effect) that is hard to scan. Almost all content earns its place, but the structure does not help the reader find the key rules quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 11-parameter destructive mutation with no output schema, the definition covers the important unknowns: overwrite behavior, helper-script installation, ambiguity handling, and element-type restrictions. It leaves gaps on what a successful result looks like and on any permission/ownership requirements for projectId, which an agent may need before invoking.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 91%, so the schema carries most per-parameter meaning, but the description adds the crucial interaction rule that text, id, match and line must all resolve to the same single element, plus matching semantics (whole word, case-insensitive) and the option format. That cross-parameter behavior is not expressible in the schema and genuinely raises it above baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb and scope ('Gives one element on a page an action') and enumerates every action with its per-action behavior (addToCart, openCart, buyNow, send, none). It also names the domain constraint (React .tsx/.jsx and plain .html) and distinguishes bulk work by pointing to the shop kit, so an agent can tell what this tool is and is not for.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives real when-not guidance: 'Read the file first' and 'for many products use the shop kit's pieces (skill shop) instead of one button at a time'. It also states the failure mode when locators do not resolve to exactly one element. It stops short of naming sibling MCP tools that cover adjacent edits, so the alternative route is described by concept rather than by tool name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources