Skip to main content
Glama

Read values with JavaScript

browser_query
Read-only

Extract only the page values you need—prices, counts, titles, or result lists—using a read-only JavaScript expression that returns JSON, avoiding full-page text or snapshots.

Instructions

Read just the values you need (prices, counts, titles, a results list) with a read-only JavaScript expression returning JSON (at most 4000 characters): the cheapest way to read, far smaller than browser_get_text or a snapshot. It runs in a world of its own where clicks, typing, submits and network writes are refused.

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": {
      "expression": "<expression>"
    },
    "name": "browser_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
schemaNoJSON Schema the result must match
expressionYese.g. [...document.querySelectorAll('.result')].slice(0,10).map(e => e.innerText)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Goes well beyond the read-only/open-world annotations by describing the isolated execution world and enumerating what is refused (clicks, typing, submits, network writes) plus the 4000-character return cap and JSON output. That is exactly the behavioral detail an agent needs before composing an expression.

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?

Two dense sentences, front-loaded with the value proposition and the return contract, then the sandbox restriction. Nothing is padding.

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?

For a two-parameter read tool with no output schema, the description covers purpose, cost trade-offs, sandbox restrictions and return format. Minor gap: "a world of its own" leaves it ambiguous whether page globals are reachable, which matters for writing the expression.

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 coverage is 100%, so both parameters are already documented, setting the baseline at 3. The description adds the JSON-return constraint and a size limit, but it never mentions the `schema` parameter and its 4000-character figure reads as a limit on the result rather than clearly on the expression itself.

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?

States a specific verb and resource ("read just the values you need ... with a read-only JavaScript expression returning JSON") and names the exact siblings it replaces (browser_get_text, a snapshot), so an agent can distinguish it without consulting 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?

Gives a clear positive selection rule (cheapest read, far smaller than get_text or snapshot) that implies when to prefer it, but never states exclusions, e.g. that you should use browser_actions or browser_click when you need to interact, or when full text is required.

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