Skip to main content
Glama
maderwin

pinchtab-mcp

Click

pinchtab_click

Click an element by its reference ID using human-like mouse events. Optionally wait for navigation or return a page snapshot after a delay.

Instructions

Click an element by its ref ID (e.g. 'e5'). Uses human-like click by default. Set waitMs to get a snapshot after clicking (saves a round-trip). For SPAs, clicking may not cause full navigation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
humanClickNoUse real mouse events (default: true). Set to false for programmatic .click().
refYesElement reference ID (e.g. 'e5')
waitMsNoWait this many ms after clicking, then return a compact page snapshot (max 10000).
waitNavNoWait for navigation after click (useful for link clicks). Default: false.

Implementation Reference

  • The tool 'pinchtab_click' is registered via server.registerTool() inside registerInteractionTools(). The registration includes the schema (lines 10-31) and the async handler (lines 34-48).
    export function registerInteractionTools(server: McpServer) {
      server.registerTool(
        "pinchtab_click",
        {
          description:
            "Click an element by its ref ID (e.g. 'e5'). Uses human-like click by default. Set waitMs to get a snapshot after clicking (saves a round-trip). For SPAs, clicking may not cause full navigation.",
          inputSchema: z.object({
            humanClick: z
              .boolean()
              .optional()
              .describe(
                "Use real mouse events (default: true). Set to false for programmatic .click().",
              ),
            ref: z.string().describe("Element reference ID (e.g. 'e5')"),
            waitMs: z
              .number()
              .optional()
              .describe(
                "Wait this many ms after clicking, then return a compact page snapshot (max 10000).",
              ),
            waitNav: z
              .boolean()
              .optional()
              .describe("Wait for navigation after click (useful for link clicks). Default: false."),
          }),
          title: "Click",
        },
        async ({ ref, humanClick, waitNav, waitMs }) => {
          try {
            const kind = humanClick === false ? "click" : "humanClick";
            const body: Record<string, unknown> = { kind, ref };
            if (waitNav) body.waitNav = true;
            await pinch("POST", "/action", body);
            if (waitMs && waitMs > 0) {
              const snap = await waitAndSnapshot(waitMs);
              return toolResult(`Clicked ${ref}\n\n${snap}`);
            }
            return toolResult({ clicked: ref });
          } catch (error) {
            return toolError(error);
          }
        },
      );
  • Zod input schema for pinchtab_click: accepts ref (string, required), humanClick (boolean, optional, defaults to true), waitMs (number, optional, max 10000), and waitNav (boolean, optional, defaults to false).
    {
      description:
        "Click an element by its ref ID (e.g. 'e5'). Uses human-like click by default. Set waitMs to get a snapshot after clicking (saves a round-trip). For SPAs, clicking may not cause full navigation.",
      inputSchema: z.object({
        humanClick: z
          .boolean()
          .optional()
          .describe(
            "Use real mouse events (default: true). Set to false for programmatic .click().",
          ),
        ref: z.string().describe("Element reference ID (e.g. 'e5')"),
        waitMs: z
          .number()
          .optional()
          .describe(
            "Wait this many ms after clicking, then return a compact page snapshot (max 10000).",
          ),
        waitNav: z
          .boolean()
          .optional()
          .describe("Wait for navigation after click (useful for link clicks). Default: false."),
      }),
  • Async handler for pinchtab_click. Determines click kind (humanClick or programmatic click), sends a POST /action request via the pinch() client, optionally waits for navigation (waitNav) or takes a snapshot (waitMs), and returns the result.
    async ({ ref, humanClick, waitNav, waitMs }) => {
      try {
        const kind = humanClick === false ? "click" : "humanClick";
        const body: Record<string, unknown> = { kind, ref };
        if (waitNav) body.waitNav = true;
        await pinch("POST", "/action", body);
        if (waitMs && waitMs > 0) {
          const snap = await waitAndSnapshot(waitMs);
          return toolResult(`Clicked ${ref}\n\n${snap}`);
        }
        return toolResult({ clicked: ref });
      } catch (error) {
        return toolError(error);
      }
    },
  • The pinch() helper function is the HTTP client that sends requests to the PinchTab server. The click handler calls pinch('POST', '/action', body) to execute the click on the browser.
    import { PINCHTAB_TOKEN, PINCHTAB_URL } from "../config.js";
    import { ensurePinchtabRunning, isPinchtabRunning } from "./process.js";
    
    const REQUEST_TIMEOUT_MS = 30_000;
    
    export async function pinch(
      method: string,
      path: string,
      body?: Record<string, unknown>,
    ): Promise<unknown> {
      if (!(await isPinchtabRunning())) {
        await ensurePinchtabRunning();
      }
    
      const headers: Record<string, string> = {
        "Content-Type": "application/json",
      };
      if (PINCHTAB_TOKEN) {
        headers["Authorization"] = `Bearer ${PINCHTAB_TOKEN}`;
      }
    
      const url = `${PINCHTAB_URL}${path}`;
    
      let res: Response;
      try {
        res = await fetch(url, {
          body: body ? JSON.stringify(body) : undefined,
          headers,
          method,
          signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
        });
      } catch (error) {
        if (error instanceof DOMException && error.name === "TimeoutError") {
          throw new Error(`PinchTab ${method} ${path} timed out after ${REQUEST_TIMEOUT_MS / 1000}s`);
        }
        throw error;
      }
    
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`PinchTab ${method} ${path} → ${res.status}: ${text}`);
      }
    
      const contentType = (res.headers.get("content-type") ?? "").split(";")[0].toLowerCase().trim();
      if (contentType === "application/json") {
        return res.json();
      }
      return res.text();
    }
  • The waitAndSnapshot() helper is used by the click handler when waitMs is provided: waits the given duration, then fetches a compact snapshot and returns it.
    import { pinch } from "../pinchtab/client.js";
    
    const MAX_WAIT_MS = 10_000;
    
    /** Wait then return a compact snapshot. Shared by navigation and interaction tools. */
    export async function waitAndSnapshot(ms: number): Promise<string> {
      const clamped = Math.min(ms, MAX_WAIT_MS);
      await new Promise((resolve) => setTimeout(resolve, clamped));
      const snapshot = await pinch("GET", "/snapshot?format=compact");
      return typeof snapshot === "string" ? snapshot : JSON.stringify(snapshot, undefined, 2);
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It covers human-like click default and waitMs snapshot, but omits error handling, navigation consequences, and return behavior. The SPA note is helpful, but gaps remain.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the main action. Every sentence provides useful information with no wasted words. Ideal conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description should cover return values, error cases, and prerequisites. It mentions waitMs returns a snapshot but does not state default return. Missing details on waitNav and error handling make it less complete than ideal.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds value by explaining default behavior (humanClick=true) and the purpose of waitMs (snapshot, saves round-trip). This enhances understanding beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (click), the resource (element by ref ID), and distinguishes from siblings like hover or focus. It provides specific examples and mentions human-like click and waiting for snapshot, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives context on when to use waitMs (to get snapshot, saves round-trip) and notes SPA behavior. However, it does not explicitly compare with alternative tools like hover or press, leaving some inferential work to the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/maderwin/pinchtab-mcp'

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