Skip to main content
Glama

find_relative

Read-onlyIdempotent

Finds an element spatially relative to an anchor—above, below, left, right, or nearest—to locate values near labels such as a total below a heading.

Instructions

[Agent Browser] Find an element spatially relative to an anchor element. Directions: 'above', 'below', 'left', 'right', 'nearest'. Use for finding data near labels (e.g., value below "Total Gain" label). Returns the closest matching element in that direction.

Note: 'anchor' uses Playwright selectors (text=, css, xpath). 'target' can be: - CSS selector (div, .class, #id) - 'text' - find nearest element with direct text content (recommended for values) - None/omitted - searches all elements (may find containers)

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": {
      "anchor": "<anchor>",
      "direction": "<direction>"
    },
    "name": "find_relative"
  }
}

Input Schema

NameRequiredDescriptionDefault
anchorYes
targetNo
directionYes
max_distanceNo

Output Schema

NameRequiredDescriptionDefault
dataNo
hintsNo
messageNo
successNo
suggestionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and non-destructive behavior, so the description is not carrying the safety burden. It adds genuinely useful context beyond them: that it returns the closest matching element in the given direction, that omitting 'target' searches all elements and may return containers, and the selector dialect used for 'anchor'.

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?

Front-loaded with the core action, then a directions line, then a usage example, then selector notes set off as a 'Note:' block. Every part maps to a parameter or the return behavior; the only mild waste is restating the direction list in prose rather than as a schema enum.

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?

An output schema exists, so return-shape explanation is not required, and the added selector semantics fill most of the schema gap. However, for a spatial-search tool it omits what happens when no element matches, the units/scope of 'max_distance', and whether the page is scrolled or the element acted upon, leaving real behavioral questions open.

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%, so the description must carry parameter meaning. It does well for 'anchor' (Playwright selectors: text=, css, xpath) and 'target' (CSS, 'text' for direct-text elements, or omitted), and lists valid direction values, but 'max_distance' (default 500) is never explained at all, leaving a quarter of the parameters undocumented anywhere.

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 opens with a specific verb and resource: 'Find an element spatially relative to an anchor element.' The spatial-relation framing plus the example ('value below "Total Gain" label') makes it distinguishable from generic element-lookup siblings such as find_elements or text without needing to open their schemas.

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 gives a clear use case: 'Use for finding data near labels (e.g., value below "Total Gain" label).' That is enough context to know when the tool applies, but it names no alternative tools and states no when-not-to-use condition, so it stops short of the top band.

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