Skip to main content
Glama
customaise

customaise

Official

get_selected_elements

Idempotent

Retrieves DOM elements a user visually selected in the browser, returning stable tiered selectors, element context, and comments for precise script targeting.

Instructions

Get DOM elements that the user has visually selected in the browser for a specific script. Returns each selection's stable, tiered selectors, element context, and user comments. Returns the selections in this response, so it needs no filesystem access. WRITES FILES only when you pass writeFiles: true, which saves .dom.md context files under the directory you name. Use CM_findElement with the domId for precise targeting in scripts. When MCP is connected, .dom.md context files and screenshots are automatically pushed to the workspace (.customaise/dom-context//) in real-time as the user selects elements. Use this tool to retrieve selections if the auto-pushed files are missing or to get the raw JSON data.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_selected_elements"
  }
}

Input Schema

NameRequiredDescriptionDefault
scriptIdNoScript ID to get selections for. Omit to get all scripts' selections.
directoryNoWorkspace directory for .dom.md files. Required if writeFiles is true.
writeFilesNoIf true, writes .dom.md context files to the workspace directory. Default: false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.2.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, which could mislead an agent into thinking this always mutates; the description resolves this by stating it writes .dom.md files only when writeFiles:true and that the response itself needs no filesystem access. It adds the auto-push behavior and target directory, both beyond the annotations. Minor gap: it does not describe size/volume of selections returned.

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

Conciseness4/5

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

The core action and return content are front-loaded, followed by the write behavior and the alternative retrieval path. It is slightly repetitive, restating the no-filesystem-access point in two sentences, but every sentence still carries operational information.

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

Completeness5/5

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

There is no output schema, and the description compensates by summarizing the return payload (selectors, element context, comments). For a zero-required-parameter read tool with an optional write mode, an agent has everything needed to call it correctly and to know when not to.

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 100%, so the baseline is 3, but the description adds real meaning: writeFiles produces .dom.md context files under the named directory, and directory is tied to that write. This clarifies the interaction between the two parameters beyond the per-field schema text.

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?

The description states a specific verb and resource: get DOM elements the user visually selected for a specific script, and it enumerates what is returned (tiered selectors, element context, user comments). It is clearly distinguishable from sibling tools like get_page_context or take_screenshot, and it routes precise targeting to CM_findElement.

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

Usage Guidelines5/5

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

It gives explicit when-to-use guidance ('retrieve selections if the auto-pushed files are missing or to get the raw JSON data') and names the alternative path (real-time auto-push to .customaise/dom-context/<script-name>/). It also names the follow-on tool, CM_findElement, and its condition for use.

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