Skip to main content
Glama

Select values on a page

select_values
Read-onlyIdempotent

Extract text or attributes from any web page using CSS or XPath selectors and get each value's location.

Instructions

Say what a CSS or XPath selector gives on a page, and where each value is.

html_or_url: an http(s) URL to fetch, or the HTML itself. selector: CSS, with ::text for an element's own text and ::attr(name) for an attribute ("span.price::text", "a::attr(href)"), or XPath ("//h1", "//a/@href"), told apart by how it begins: an XPath begins with /, ./, ( or @, or is written after "xpath:". respect_tdm: answer tdm_reserved when the site reserves its text and data mining rights (TDMRep).

Returns {"ok", "url", "values", "count"}, and "fetch" for a URL: values are {"value", "where"}, the text or attribute read, spaces collapsed, links resolved, and the XPath of its element; count is how many the selector gave. A selector that cannot be read is bad_input naming it; one that gives nothing is ok with no values. Past 75,000 bytes the last values are left out, counted in values_left_out. Use it to try the selectors compile_extractor's select takes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS, with ::text for an element's own text and ::attr(name) for an attribute ("span.price::text", "a::attr(href)"), or XPath ("//h1", "//a/@href"), told apart by how it begins: an XPath begins with /, ./, ( or @, or is written after "xpath:".
html_or_urlYesan http(s) URL to fetch, or the HTML itself.
respect_tdmNoanswer tdm_reserved when the site reserves its text and data mining rights (TDMRep).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
urlNo
countNo
errorNo
fetchNo
valuesNo
values_left_outNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.0

TDQS

A4.4/5.0
Behavior5/5

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

The description goes far beyond the annotations (readOnlyHint=true, idempotentHint=true, destructiveHint=false) by detailing the exact return format (ok, url, values, count), error handling (bad_input for unreadable selectors, ok with no values for no matches), truncation behavior beyond 75,000 bytes with values_left_out, and respect_tdm behavior. This is rich contextual information that helps an agent anticipate edge cases.

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 description is well-structured and front-loaded with a clear purpose. It then systematically covers parameter syntax, return format, error cases, and truncation. Each sentence contributes value, but it is somewhat dense and lengthy. It is concise for the complexity, earning a 4 rather than a 5.

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?

Given the tool's complexity and the presence of an output schema (implied by the description), the description is complete. It explains the return structure, error scenarios, truncation, and TDM handling. The only minor ambiguity is the 'fetch' phrasing, but overall an agent has sufficient information to call the tool correctly.

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 100%, and the description largely repeats the parameter details already in the schema (e.g., selector syntax, html_or_url meaning, respect_tdm effect). It adds marginal new meaning, such as the output semantics tied to parameters, but for the parameters themselves it does not significantly enhance the schema's explanations. The baseline of 3 is appropriate since the schema carries the load.

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 clear purpose: 'Say what a CSS or XPath selector gives on a page, and where each value is.' It specifies the verb (select values), resource (page), and the scope (via selectors). It also differentiates from siblings by explicitly referencing compile_extractor for testing selectors, which helps distinguish it in the tool list.

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?

The description gives a clear usage context: 'Use it to try the selectors compile_extractor's select takes.' This tells the agent when to use it for selector verification. However, it does not explicitly state when not to use it or mention alternatives like page_markdown or extract_declared, so exclusions are absent. It provides clear context but not exhaustive when/when-not guidance.

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