Skip to main content
Glama

browser_click

Simulate single or double clicks on specific web elements using Playwright MCP. Specify target elements and buttons for precise browser interactions.

Instructions

Perform click on a web page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buttonNoButton to click, defaults to left
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

  • Handler function that performs the click action on the element locator from page snapshot, generates equivalent Playwright code, and returns execution metadata.
    handle: async (context, params) => { const tab = context.currentTabOrDie(); const locator = tab.snapshotOrDie().refLocator(params); const code = [ `// Click ${params.element}`, `await page.${await generateLocator(locator)}.click();` ]; return { code, action: () => locator.click(), captureSnapshot: true, waitForNetwork: true, }; },
  • MCP tool schema for 'browser_click' defining name, title, description, input schema (elementSchema), and destructive type.
    schema: { name: 'browser_click', title: 'Click', description: 'Perform click on a web page', inputSchema: elementSchema, type: 'destructive', },
  • Zod input schema for browser_click: requires 'element' (human-readable desc) and 'ref' (snapshot reference).
    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'), });
  • src/tools.ts:36-52 (registration)
    Registers 'browser_click' tool by spreading the snapshot module export (which includes browser_click) into the snapshotTools array for use in MCP context.
    export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...video, ...wait(true), ];
  • Includes 'browser_click' (as 'click') in the module's default export array for registration in parent tools.ts.
    export default [ snapshot, click, drag, hover, type, selectOption, ];

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/lewisvoncken/playwright-mcp'

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