Skip to main content
Glama

get_page_elements

Extract elements from a webpage by CSS selector, returning tag, text, id, class, href, and other attributes. Supports optional full text and extra HTML attributes for detailed inspection.

Instructions

List elements matching a CSS selector with their attributes (tag, text, id, class, href, value, visible, enabled, aria_label, role). Pass 'attributes' for extra HTML attributes (data-, aria-, style, ...) and 'full_text' for complete text content instead of the 80-char preview. Works on a session or a URL. Standard CSS selectors only — Playwright-specific pseudo-classes (:has-text, :visible) are not supported here.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoURL to open (use this or session_id)
projectNoProject name (optional). With a project: runs in its shared, authenticated context. Without: runs in an isolated context (no shared cookies/login).
selectorYesCSS selector to match elements
full_textNoReturn full text content instead of an 80-char preview (default: false)
attributesNoExtra HTML attribute values to include per element (e.g. data-testid, aria-expanded, style)
session_idNoSession ID (use this or url)
max_resultsNoMax elements to return (default: 50)
Behavior4/5

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

No annotations are provided, so the description must carry behavioral details. It states the tool works on a session or URL, lists default returned attributes, and mentions the 80-char text preview and options for full text/extra attributes. It does not disclose behavior for no matches or error conditions, but the read-only nature is clear.

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?

The description is two sentences, front-loading the main purpose. The second sentence is moderately long but packed with useful detail. Could be split for readability, but overall efficient.

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 list tool with a clear schema, the description covers the key output and parameter options. It does not mention the default 'max_results' of 50 or pagination, but these are in the schema. The description is sufficient for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds value by explaining how to use the 'attributes' and 'full_text' parameters beyond the schema definitions. It also clarifies the mutual exclusivity of 'url' and 'session_id' (implicitly).

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 'List elements matching a CSS selector with their attributes', using a specific verb and resource. It distinguishes from sibling tools like 'find_element' (single element) and 'click_element' (action).

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?

The description notes that only standard CSS selectors are supported and Playwright pseudo-classes are not, which helps avoid misuse. It also explains how to get extra attributes and full text, but does not explicitly contrast with alternatives like 'find_element' or 'get_page_html'.

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/segentic-lab/periscope-mcp'

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