Skip to main content
Glama

Resolve a unique element target

resolve_target

Find one visible element by CSS selector or role/name, returning its ref, frame, and document for actions. Inspect existing refs for reusable targets and field sensitivity without values.

Instructions

Find exactly one visible element by CSS selector (including open shadow roots) or exact simplified role/name. Optional frameId restricts lookup; otherwise scans accessible frames. Ambiguous or missing targets fail. Returns ref, frameId and documentId for document-bound actions; names use the same practical DOM semantics as read_page, not a full ARIA computation. Alternatively, describeRef with optional documentId inspects an issued ref and returns a globally unique reusable target and field sensitivity metadata without field values; no reusable target is promised when one cannot be proved. Supply target or describeRef, never both.

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": {
      "tabId": "<tabId>"
    },
    "name": "resolve_target"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabIdYes
targetNo
documentIdNo
describeRefNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.24.1

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does substantial work: it discloses failure policy on ambiguity, shadow-DOM reach, automatic cross-frame scanning, and that refs are bound to a documentId for follow-on actions. The describeRef mode is unusually honest about its own reliability ('no reusable target is promised when one cannot be proved') and states it returns sensitivity metadata 'without field values.' Not covered: any prerequisite state (page loaded/stable), latency, or whether multiple matches are ever returned rather than failing.

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?

Every sentence carries information, and the primary mode is front-loaded, but the prose is a semicolon-chained run-on that is hard to scan. The second mode (describeRef) is buried mid-paragraph instead of being separated, which makes it easy to miss that this tool does two quite different things.

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?

With four parameters, no annotations, and no output schema, the description steps up: it names the return values (ref, frameId, documentId) and describes what describeRef yields. An agent has enough to call it correctly and interpret the result. It could say more about preconditions and about what happens with duplicate matches beyond 'fail'.

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 0%, so the description must compensate and mostly does: it explains both shapes of the target object (selector, or role+name), the meaning of frameId in each mode, that describeRef works on an already-issued ref with an optional documentId scope, and that target and describeRef are mutually exclusive. Residual gaps: tabId is never explained, and documentId's effect on resolution scope is only obliquely implied by 'inspects an issued ref'.

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

Purpose4/5

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

The opening clause names a specific verb and resource ('Find exactly one visible element by CSS selector ... or exact simplified role/name') and scopes it (open shadow roots, visible only). It also distinguishes its name-matching semantics from read_page ('not a full ARIA computation'), which heads off a plausible misuse. It does not distinguish itself from the sibling 'find', leaving one ambiguity about which element-lookup tool to pick.

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 clear operating conditions rather than a bare when-to-use: 'Ambiguous or missing targets fail', frameId restricts the scan 'otherwise scans accessible frames', and the explicit invocation rule 'Supply target or describeRef, never both.' The 'for document-bound actions' phrasing implies this is a prerequisite step for later actions. It stops short of naming an alternative tool or an explicit when-not condition.

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