Skip to main content
Glama

validate_selector

Read-onlyIdempotent

Check a selector before running an action to confirm it matches elements, see the match count and sample text, and get suggestions when ambiguous—preventing blind failures.

Instructions

[Agent Browser] Validate a selector before using it in an action. Use to check if a selector matches elements and how many, preventing blind failures. Returns match count, sample text, and suggestions for ambiguous selectors. Lightweight alternative to find_elements for quick validation.

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": {
      "selector": "<selector>"
    },
    "name": "validate_selector"
  }
}

Input Schema

NameRequiredDescriptionDefault
selectorYes

Output Schema

NameRequiredDescriptionDefault
dataNo
hintsNo
messageNo
successNo
suggestionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and a closed-world scope, so safety is covered. The description adds value beyond that by disclosing the output content (match count, sample text, suggestions for ambiguous selectors) and the failure-prevention behavior, which is not inferable from annotations.

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?

Four short sentences, front-loaded with the core purpose and followed by usage, return content, and the sibling comparison. Each sentence earns its place, though the return-value sentence partly duplicates the existing output schema.

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 an output schema present and rich annotations, the description covers purpose, timing, output gist, and the main alternative. The only notable omission is selector-format guidance, which would be the difference between good and complete for this tool.

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

Parameters3/5

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

Schema description coverage is 0% for the single 'selector' parameter, so the description carries the burden of explaining it. It implies the selector is the same one used in browser actions, but never states the accepted format (CSS, XPath, text) — a meaningful gap for a one-parameter validation tool.

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 uses a specific verb and resource ('Validate a selector') and explicitly distinguishes the tool from a sibling by calling it a 'lightweight alternative to find_elements'. An agent can tell what it does and how it differs without opening either schema.

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?

It states the use case clearly: run this before using a selector in an action to check whether it matches and how many elements it hits, preventing blind failures. It also names find_elements as the heavier alternative, though it does not state explicit when-not conditions.

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