Skip to main content
Glama

browser_click

Simulate clicks on web page elements to test interactions and verify WCAG compliance, ensuring accessibility across user workflows with precise element targeting.

Instructions

Perform click on a web page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doubleClickNoWhether to perform a double click instead of a single click
elementYesHuman-readable element description used to obtain permission to interact with the element
refYesExact target element reference from the page snapshot

Implementation Reference

  • Executes the browser_click tool: resolves element locator from params, generates code snippet for click/dblclick, performs the action via Playwright on the tab's page.
    handle: async (tab, params, response) => { response.setIncludeSnapshot(); const locator = await tab.refLocator(params); const button = params.button; const buttonAttr = button ? `{ button: '${button}' }` : ''; if (params.doubleClick) response.addCode(`await page.${await generateLocator(locator)}.dblclick(${buttonAttr});`); else response.addCode(`await page.${await generateLocator(locator)}.click(${buttonAttr});`); await tab.waitForCompletion(async () => { if (params.doubleClick) await locator.dblclick({ button }); else await locator.click({ button }); }); },
  • Defines Zod schemas for input validation: base elementSchema (element desc, ref), clickSchema extending it with doubleClick and button options. Used in tool schema with name 'browser_click'.
    export const elementSchema = z.object({ element: z.string().describe('Human-readable element description used to obtain permission to interact with the element'), ref: z.string().describe('Exact target element reference from the page snapshot'), }); const clickSchema = elementSchema.extend({ doubleClick: z.boolean().optional().describe('Whether to perform a double click instead of a single click'), button: z.enum(['left', 'right', 'middle']).optional().describe('Button to click, defaults to left'), }); const click = defineTabTool({ capability: 'core', schema: { name: 'browser_click', title: 'Click', description: 'Perform click on a web page', inputSchema: clickSchema, type: 'destructive', },
  • src/tools.ts:38-56 (registration)
    Registers the browser_click tool by including the snapshot module's tools (via ...snapshot) in the allTools array, which is filtered into _tools used by BrowserServerBackend for MCP listTools().
    export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...form, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ...verify, ];
  • In BrowserServerBackend constructor, sets this._tools = filteredTools(config), which includes browser_click, used for dispatching calls and listing in MCP.
    constructor(config: FullConfig, factory: BrowserContextFactory) { this._config = config; this._browserContextFactory = factory; this._tools = filteredTools(config); }
  • BrowserServerBackend.listTools() converts tool schemas including browser_click to MCP Tool format for registration with the MCP server.
    async listTools(): Promise<mcpServer.Tool[]> { return this._tools.map(tool => toMcpTool(tool.schema)); }

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/JustasMonkev/mcp-accessibility-scanner'

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