Skip to main content
Glama

selector_for

Builds a CSS selector and XPath for a page element from its tag, ID, test hook, or position; for shadow-root or iframe elements, it returns a query_selector-followable chain.

Instructions

A CSS selector and an XPath for one element, built from its tag, id, test-hook or position. For an element in a shadow root or an iframe it answers with a chain that query_selector follows.

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": "selector_for"
  }
}

Input Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.2.1

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses the output shape and the chained-selector behavior for shadow roots and iframes, but it does not state whether the operation is read-only, what happens when no element is found, or how the target element is supplied.

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

Conciseness5/5

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

The definition is two sentences and is front-loaded with the core output. The second sentence adds a focused special case about shadow roots and iframes without unnecessary repetition.

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

Completeness3/5

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

For a simple selector-generation tool with no annotations and no output schema, the description explains the return concept and special-case chaining. Its main gap is that it never explains how the caller specifies the target element, which is important even when the input schema is empty.

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?

The tool has zero parameters, so the baseline is 4. The description adds relevant semantics by stating that selectors are built from tag, id, test-hook, or position, though it remains unclear how the element itself is identified at call time because the schema is empty.

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 description clearly states that the tool produces a CSS selector and an XPath for a single element, and it names the basis (tag, id, test-hook, or position). It also distinguishes special handling for shadow roots and iframes, though it does not explicitly contrast itself with all relevant siblings beyond mentioning that `query_selector` follows its chain.

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

Usage Guidelines3/5

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

The description implies usage when a CSS selector or XPath is needed for an element, especially in shadow DOM or iframe contexts. However, it gives no explicit when-to-use or when-not-to-use guidance and does not position other tools as alternatives.

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