Skip to main content
Glama
epi-builder
by epi-builder

browser_click

Click on web page elements to automate browser interactions, using element references for precise targeting in Playwright automation workflows.

Instructions

Click on an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementYesHuman-readable element description
refYesExact target element reference from page snapshot

Implementation Reference

  • The core handler function that executes the browser_click tool logic. It ensures a browser page is open and performs a click action (currently a placeholder clicking on 'body').
    private async handleClick(element: string, ref: string) { await this.ensureBrowser(); // Simple click implementation - in a real implementation, // you would parse the ref to find the actual element await this.browserState.page!.click('body'); // Placeholder return { content: [ { type: 'text', text: `Clicked on ${element}`, }, ], }; }
  • src/server.ts:82-99 (registration)
    Registration of the browser_click tool in the list of available tools, including its name, description, and input schema definition.
    { name: 'browser_click', description: 'Click on an element', inputSchema: { type: 'object', properties: { element: { type: 'string', description: 'Human-readable element description', }, ref: { type: 'string', description: 'Exact target element reference from page snapshot', }, }, required: ['element', 'ref'], }, },
  • Dispatch case in the CallToolRequestSchema handler that routes browser_click calls to the handleClick method.
    case 'browser_click': return await this.handleClick(args?.element as string, args?.ref as string);
  • Helper method used by browser_click handler to ensure a browser and page are initialized.
    private async ensureBrowser() { if (!this.browserState.browser) { this.browserState.browser = await chromium.launch({ headless: false, }); } if (!this.browserState.page) { this.browserState.page = await this.browserState.browser.newPage(); } }

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/epi-builder/mcp-test'

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