Skip to main content
Glama

查询页面元素

wdt_query
Read-only

Query current page elements with a CSS selector and return summaries including tag name, text, id/class, and value; optionally return all matches or limit results.

Instructions

用 CSS 选择器查询当前页面元素,返回 tagName、文本、id/class、value 等摘要。

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": "wdt_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
allNo是否返回全部匹配项,默认只返回第一个
maxNo最多返回数量,默认 20
selectorYesCSS 选择器,如 .btn 或 #title

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.2

TDQS

B3.2/5.0
Behavior3/5

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

readOnlyHint=true already tells the agent this is a safe, non-mutating read, so the safety burden is covered. The description adds value by disclosing the returned summary fields, which is genuinely useful. It does not, however, disclose whether hidden elements, shadow DOM, or iframes are searched, nor whether it waits for elements to appear — meaningful gaps for a DOM query tool.

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?

A single compact sentence that front-loads the mechanism and then the return payload, with no filler. Nothing is redundant; the only mild shortfall is that brevity leaves behavior unstated rather than that any sentence is wasted.

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 three-parameter read-only query tool with full schema coverage and no output schema, the description covers purpose, method, and the return summary, and the annotations carry the safety profile. Missing only edge-case behavior (multiple matches, hidden elements), which is a modest gap rather than a blocking one.

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 all three parameters (selector, all, max) are documented in the schema with examples and defaults. The description adds no additional meaning about selector syntax or the all/max interplay, so the baseline 3 applies — the schema does all the parameter work.

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?

The description names a specific verb (查询/query), a specific resource (当前页面元素), the mechanism (CSS 选择器), and the shape of what comes back (tagName、文本、id/class、value 等摘要). An agent can tell this is a DOM element lookup rather than a script evaluation or navigation. It stops short of naming a sibling such as wdt_element or wdt_evaluate, so it is clear but not differentiating.

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?

There is no explicit when-to-use or when-not-to-use guidance, and no alternative is mentioned. The phrase 查询当前页面元素 implies the context (a loaded page, looking for elements), but nothing tells the agent whether to prefer this over wdt_element or wdt_evaluate, or what preconditions exist (page connected, elements rendered).

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