Skip to main content
Glama
AdsPower

AdsPower LocalAPI MCP Server

Official

get-page-visible-text

Extract visible text from web pages using AdsPower LocalAPI MCP Server to enable content retrieval for analysis or integration into workflows.

Instructions

Get the visible text content of the page

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • The core handler function for 'get-page-visible-text' that uses Puppeteer's evaluate to run JavaScript extracting visible text from the page using TreeWalker on text nodes, filtering hidden elements via computed styles.
    async getPageVisibleText() { browser.checkConnected(); try { const visibleText = await browser.pageInstance!.evaluate(() => { const walker = document.createTreeWalker( document.body, NodeFilter.SHOW_TEXT, { acceptNode: (node) => { const style = window.getComputedStyle( node.parentElement! ); return style.display !== 'none' && style.visibility !== 'hidden' ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT; }, } ); let text = ''; let node; while ((node = walker.nextNode())) { const trimmedText = node.textContent?.trim(); if (trimmedText) { text += trimmedText + '\n'; } } return text.trim(); }); return `Visible text content:\n${visibleText}`; } catch (error) { return `Failed to get visible text content: ${(error as Error).message}`; } },
  • Registers the 'get-page-visible-text' tool on the MCP server with description, empty input schema, and wrapped automation handler.
    server.tool('get-page-visible-text', 'Get the visible text content of the page', schemas.emptySchema.shape, wrapHandler(automationHandlers.getPageVisibleText));

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/AdsPower/local-api-mcp-typescript'

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