puppeteer_click
Automate web interactions by clicking elements using a CSS selector. This tool enables precise browser automation and integration with Puppeteer MCP Server for seamless web page manipulation.
Instructions
Click an element on the page
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"selector": "<selector>"
},
"name": "puppeteer_click"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to click |
Implementation Reference
- index.ts:226-250 (handler)The main handler logic for the 'puppeteer_click' tool. It attempts to click the element specified by the CSS selector using Puppeteer's page.click method and returns a success or error message.
case "puppeteer_click": try { await page.click(args.selector); return { content: [ { type: "text", text: `Clicked: ${args.selector}`, }, ], isError: false, }; } catch (error) { return { content: [ { type: "text", text: `Failed to click ${args.selector}: ${ (error as Error).message }`, }, ], isError: true, }; } - index.ts:56-65 (schema)Input schema definition for the puppeteer_click tool, specifying the required 'selector' parameter as a string.
inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to click", }, }, required: ["selector"], }, - index.ts:53-66 (registration)Registration of the puppeteer_click tool in the TOOLS array, which is served via ListToolsRequestSchema.
{ name: "puppeteer_click", description: "Click an element on the page", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to click", }, }, required: ["selector"], }, },