Skip to main content
Glama
maderwin

pinchtab-mcp

Focus

pinchtab_focus

Focus an element by its ref ID to trigger focus-dependent UI like autocomplete dropdowns without manual clicking.

Instructions

Focus an element by its ref ID. Useful for triggering focus-dependent UI (e.g. autocomplete dropdowns) without clicking.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refYesElement reference ID (e.g. 'e3')

Implementation Reference

  • The handler function for pinchtab_focus: sends a POST /action request with kind:'focus' and the ref ID to the PinchTab server. Returns the result or error.
      async ({ ref }) => {
        try {
          return toolResult(
            await pinch("POST", "/action", {
              kind: "focus",
              ref,
            }),
          );
        } catch (error) {
          return toolError(error);
        }
      },
    );
  • Input schema for pinchtab_focus: requires a 'ref' string describing the element reference ID (e.g. 'e3').
    {
      description:
        "Focus an element by its ref ID. Useful for triggering focus-dependent UI (e.g. autocomplete dropdowns) without clicking.",
      inputSchema: z.object({
        ref: z.string().describe("Element reference ID (e.g. 'e3')"),
      }),
      title: "Focus",
  • Registration of the 'pinchtab_focus' tool via server.registerTool() with title 'Focus' and description about focusing elements.
    server.registerTool(
      "pinchtab_focus",
      {
        description:
          "Focus an element by its ref ID. Useful for triggering focus-dependent UI (e.g. autocomplete dropdowns) without clicking.",
        inputSchema: z.object({
          ref: z.string().describe("Element reference ID (e.g. 'e3')"),
        }),
        title: "Focus",
      },
      async ({ ref }) => {
        try {
          return toolResult(
            await pinch("POST", "/action", {
              kind: "focus",
              ref,
            }),
          );
        } catch (error) {
          return toolError(error);
        }
      },
    );
  • registerAllTools() calls registerInteractionTools(server) which registers pinchtab_focus along with other interaction tools.
    export function registerAllTools(server: McpServer) {
      registerInstanceTools(server);
      registerNavigationTools(server);
      registerInteractionTools(server);
      registerContentTools(server);
    }
  • The pinch() helper function used by the handler to make HTTP POST requests to the PinchTab server's /action endpoint.
    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();
    }
Behavior3/5

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

No annotations provided; description mentions UI effect but omits behavior on failure (e.g., if element not focusable) or side effects. Adequate for a simple action.

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?

Two clear, front-loaded sentences. No unnecessary words; every sentence adds value.

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

Completeness4/5

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

Sufficient for a single-parameter, no-output tool. Explains purpose and use case, but lacks details on error handling or prerequisites (e.g., element must be focusable). Mostly complete.

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

Parameters3/5

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

Schema coverage is 100% with description of 'ref' parameter. Description adds no extra meaning beyond schema (e.g., 'Element reference ID'). Baseline score.

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?

Clearly specifies verb 'Focus' and resource 'element by ref ID'. Distinguishes from sibling 'pinchtab_click' by noting it triggers focus without clicking.

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?

Provides clear context for when to use (triggering focus-dependent UI like autocomplete dropdowns) and implies not to use click. Lacks explicit when-not-to-use or alternative tools.

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