Skip to main content
Glama

query

Extract page elements by CSS selector and return structured HTML-like output with accessible names or plain text content for AI browser automation.

Instructions

Query elements on the page using CSS selectors. Can extract structure (HTML-like representation with accessible names) or text content.

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

Input Schema

NameRequiredDescriptionDefault
depthNoMaximum depth for structure extraction. Default: 10
limitNoCharacter limit for text extraction (0 = no limit). Default: 0
extractNoWhat to extract: "structure" for HTML-like tree with accessible names, "text" for plain text content. Default: structure
sessionYesThe session name to query
selectorYesCSS selector to match elements (e.g., "main", "form", "#content")

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden. It hints at the two return shapes but never states that this is a read-only, non-mutating operation, nor what happens when the selector matches zero or many elements, nor whether results are truncated.

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 short sentences, front-loaded with the core action and followed by the extraction capability. No filler or redundant phrasing.

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?

Five parameters with full schema coverage keep the description's job small, but with no annotations and no output schema, an agent still lacks confirmation that this is a safe read and how empty or oversized matches are handled.

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%, so the schema already documents session, selector, depth, limit, and extract. The description only restates the structure-versus-text distinction that the extract enum already explains, adding no syntax or default detail beyond the schema.

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?

States a specific verb and resource: query elements on the page via CSS selectors, with two extraction modes. It does not distinguish itself from lookalike siblings such as elements, section, or overview, so an agent must infer the boundary.

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

Usage Guidelines2/5

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

No when-to-use or when-not-to-use guidance, and no mention of the sibling tools it overlaps with. The only usage signal is the implicit need for an existing session and a valid selector, neither of which is stated as a prerequisite.

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