Skip to main content
Glama

getOgExtract

Read-onlyIdempotent

Extract targeted content from any URL using HTML tag names or custom CSS selectors. Supports JavaScript rendering for dynamic pages.

Instructions

Extract specific content from any URL via the OpenGraph.io API (v3). Two modes — choose based on what you need:

Mode 1 — Tag-based (html_elements): pass an array of HTML tag names, e.g. ['h1','h2','p','a']. The API collects all matching elements and joins their text into a single concatenatedText string. Best for bulk content extraction where you want all headings, paragraphs, or links as one block of text.

Mode 2 — Selector-based (selectors): pass a CSS selector map where each key is your chosen label and each value is a CSS selector, e.g. { "title": "article h1", "price": ".price-box .price", "sku": "#product-sku" }. The API returns a data object keyed by those labels — ideal for structured scraping of specific named fields.

Response shape by mode:

  • html_elements only → { concatenatedText }

  • selectors only → { data, concatenatedText }

  • Both provided → { data, concatenatedText }

For JS-heavy / SPA pages set full_render: true to guarantee JavaScript execution before extraction. Use wait_for_selector when content loads asynchronously.

Pick the right tool: getOgData → Open Graph tags, social preview metadata (title, description, image, favicon) getOgMarkdown → Clean readable text / article prose — ideal for feeding into an LLM getOgScrapeData → Raw HTML — use when you need to do your own parsing or link extraction getOgExtract → Targeted elements by tag (html_elements) or named CSS selectors (selectors) getOgScreenshot → Visual capture of a page as an image getOgQuery → Natural-language question answered from page content (100–200 credits/request)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the webpage to extract content from.
retryNoAutomatically retry failed requests. Defaults to true on v3.
cache_okNoUse cached results. Set to false to bypass cache. Defaults to true.
selectorsNoCSS selector map for structured extraction. Keys are output labels; values are CSS selectors. Example: { "article_title": "article h1", "price": ".price-box .price", "description": "#product-description p" }. When provided, returns a structured `data` object keyed by label instead of a raw element list. Can be combined with html_elements.
use_proxyNoRoute the request through a standard proxy.
auto_proxyNoAutomatically escalate to a proxy if the direct request fails. Defaults to true on v3.
accept_langNoAccept-Language header for the outbound request. Defaults to 'auto'.
ai_sanitizeNoScan the fetched content for prompt-injection attempts.
auto_renderNoAutomatically detect and switch to headless rendering for SPA pages. Defaults to true on v3.
full_renderNoFully render the page with JavaScript before extracting. Useful for SPAs.
max_retriesNoMaximum number of retry attempts (1–4). Defaults to 4.
use_premiumNoRoute the request through a premium proxy.
use_superiorNoRoute the request through a superior-tier proxy.
html_elementsNoList of HTML tag names to extract (e.g. ['h1', 'h2', 'a', 'img', 'p']). Defaults to ['title','h1','h2','h3','h4','h5','p'] when neither html_elements nor selectors is provided.
max_cache_ageNoMaximum cache age in milliseconds. Defaults to 432000000 (5 days).
proxy_countryNoTwo-letter ISO country code for geo-targeted proxy exit node.
load_more_waitNoMilliseconds to wait after each load_more click (0–5000). Defaults to 1500.
retry_escalateNoEscalate proxy tier on each retry attempt. Defaults to true.
ai_sanitize_modeNo'sanitize' cleans the content, 'warn' returns a safety report, 'block' returns HTTP 422.
load_more_clicksNoNumber of times to click the load_more_selector (1–10). Defaults to 3.
load_more_scrollNoScroll between load_more clicks. Defaults to true.
scroll_to_bottomNoScroll to the bottom of the page before extracting. Useful for lazy-loaded content.
wait_for_selectorNoCSS selector to wait for before extracting.
load_more_selectorNoCSS selector for a 'load more' button to click before extracting.
load_more_item_selectorNoCSS selector to watch for new items when using load_more_selector.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
dataNoStructured object keyed by your selector labels. Only present when the selectors param was used.
concatenatedTextNoAll matched element text joined into one string. Present in both html_elements and selectors modes.
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, etc. The description adds mode behavior, default values (e.g., html_elements default list), response shapes per mode, and proxy escalation logic. No contradictions with annotations.

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 relatively long but well-structured with clear sections (modes, response shapes, special params, sibling comparison). Every sentence has purpose, though a few technical details could be tightened.

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?

Given 25 parameters and an output schema, the description covers the two primary modes, default behaviors, and important options. It lacks some edge-case clarifications but is sufficiently complete 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%, so baseline is 3. The description adds significant meaning: explains the two parameter groups (html_elements vs selectors) with examples, describes defaults, and clarifies how modes affect output. Some parameters (e.g., retry, cache_ok) get less attention, but overall adds value.

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 it extracts specific content from URLs via OpenGraph.io API v3, and lists two distinct modes with examples. It distinguishes itself from siblings by contrasting each sibling's purpose in a dedicated bullet list.

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?

The description explicitly explains when to use tag-based vs selector-based mode, and provides a complete sibling comparison table. It also gives guidance on when to use parameters like full_render and wait_for_selector.

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/securecoders/opengraph-io-mcp'

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