Skip to main content
Glama

get_element_text

Extract text content from a web element using a CSS selector with a customizable timeout via AutoProbeMCP's browser automation capabilities.

Instructions

Get text content of an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for the element
timeoutNoTimeout in milliseconds

Implementation Reference

  • Handler for the 'get_element_text' tool. Validates input with GetElementTextSchema, retrieves text content from the specified selector using Playwright's page.textContent method, and returns the text or '(empty)' if none.
    case 'get_element_text': { if (!currentPage) { throw new Error('No browser page available. Launch a browser first.'); } const params = GetElementTextSchema.parse(args); const text = await currentPage.textContent(params.selector, { timeout: params.timeout }); return { content: [ { type: 'text', text: `Element text: ${text || '(empty)'}` } ] }; }
  • Zod schema for validating input parameters of the get_element_text tool: selector (required string) and optional timeout (default 5000ms).
    const GetElementTextSchema = z.object({ selector: z.string(), timeout: z.number().default(5000) });
  • src/index.ts:237-255 (registration)
    Tool registration in the listTools response, defining name, description, and inputSchema matching the Zod schema.
    { name: 'get_element_text', description: 'Get text content of an element', inputSchema: { type: 'object', properties: { selector: { type: 'string', description: 'CSS selector for the element' }, timeout: { type: 'number', default: 5000, description: 'Timeout in milliseconds' } }, required: ['selector'] } },

Other Tools

Related 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/Wladastic/AutoProbeMCP'

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