Skip to main content
Glama

count

Read-onlyIdempotent

Determine the number of elements matching a selector, including hidden ones. Use to verify list lengths, check existence, or before clicking the nth element.

Instructions

[Agent Browser] Count how many elements match a selector (includes hidden). Use to verify list lengths, check if elements exist, or before click_nth(). Returns data.count. For detailed element info, use find_elements().

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

Input Schema

NameRequiredDescriptionDefault
selectorYes

Output Schema

NameRequiredDescriptionDefault
dataNo
hintsNo
messageNo
successNo
suggestionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive and closed-world, so the safety profile is covered. The description adds genuinely new behavior with '(includes hidden)', which tells the agent that visibility filtering does not apply and counts may exceed visible elements — a real gotcha for assertions. It does not discuss performance or cost on large DOMs, keeping it short of a 5.

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?

Three short sentences: purpose first, usage second, alternative last. No filler, and the most decision-relevant information (what it counts) is front-loaded.

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 one-parameter counter with an output schema present, the description covers purpose, use cases, and the sibling alternative, so an agent can call it correctly. The only meaningful gap is the unspecified selector syntax, which the schema also leaves undocumented.

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 0% for the single 'selector' parameter, so the description must carry the burden — but it only says elements 'match a selector' without specifying CSS vs. XPath vs. text syntax. The '(includes hidden)' note adds meaning about result semantics rather than the parameter 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 — 'Count how many elements match a selector' — and adds a scoping qualifier ('includes hidden') that separates it from element-listing tools. An agent can distinguish it from find_elements without opening either schema.

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

Usage Guidelines5/5

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

Explicitly names three use cases (verify list lengths, check existence, before click_nth()) and routes detailed inspection to find_elements(). Both the when-to-use and the alternative are stated outright.

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