Skip to main content
Glama
Himangguo
by Himangguo

query_selector

Finds all DOM elements matching a CSS selector and returns their tag name, ID, and class list for debugging and inspection.

Instructions

在 DOM 中查找匹配选择器的所有元素,返回元素基本信息(tagName/id/classList)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS 选择器
Behavior4/5

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

With no annotations, the description carries the disclosure burden. It transparently conveys a read-only operation ('find', 'return') and specifies output fields and that all matching elements are returned. It does not address edge cases like invalid selectors, but for a simple DOM query this is adequate.

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?

The description is a single sentence, front-loaded with the action verb 'find', and contains no redundant wording. It efficiently conveys the tool's purpose and output.

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 simple tool with one parameter and no output schema, the description sufficiently covers purpose and return shape (tagName/id/classList for all matches). It lacks explicit mention of the return type (e.g., array) or behavior on zero matches, but the core information is present and unambiguous.

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?

The input schema already fully documents the 'selector' parameter at 100% coverage (description: 'CSS 选择器'). The description adds little semantic detail beyond restating that the selector is used for matching, so the baseline score of 3 is appropriate.

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 clearly states the tool finds all DOM elements matching a CSS selector and returns basic element info (tagName, id, classList). This distinguishes it from sibling tools like get_dom_tree (whole tree) or get_computed_styles (styles).

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

Usage Guidelines3/5

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

The description implies usage for locating elements by selector, but does not explicitly state when to use it over alternatives like get_dom_tree or get_computed_styles, nor when not to use it. With a list of sibling tools provided, adding explicit alternative guidance would improve this dimensions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Himangguo/chrome-devtools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server