package mcp import "github.com/mark3labs/mcp-go/mcp" // allTools returns every MCP tool exposed by the PinchTab MCP server. func allTools() []mcp.Tool { return []mcp.Tool{ // ── Navigation ────────────────────────────────────────────── mcp.NewTool("pinchtab_navigate", mcp.WithDescription("Navigate to a URL in the browser"), mcp.WithString("url", mcp.Required(), mcp.Description("The URL to navigate to")), mcp.WithString("tabId", mcp.Description("Target tab ID (optional, uses current tab if empty)")), ), mcp.NewTool("pinchtab_snapshot", mcp.WithDescription("Get an accessibility tree snapshot of the current page"), mcp.WithString("tabId", mcp.Description("Target tab ID")), mcp.WithBoolean("interactive", mcp.Description("Only interactive elements (buttons, links, inputs)")), mcp.WithBoolean("compact", mcp.Description("Compact format (most token-efficient)")), mcp.WithBoolean("diff", mcp.Description("Only changes since last snapshot")), mcp.WithString("selector", mcp.Description("Unified selector to scope the snapshot (CSS, XPath, text, or ref)")), ), mcp.NewTool("pinchtab_screenshot", mcp.WithDescription("Take a screenshot of the current page"), mcp.WithString("tabId", mcp.Description("Target tab ID")), mcp.WithString("format", mcp.Description("Image format: 'jpeg' (default) or 'png'")), mcp.WithNumber("quality", mcp.Description("JPEG quality 0-100 (only for JPEG format)")), ), mcp.NewTool("pinchtab_get_text", mcp.WithDescription("Extract readable text content from the current page"), mcp.WithString("tabId", mcp.Description("Target tab ID")), mcp.WithBoolean("raw", mcp.Description("Return raw text without formatting")), ), // ── Interaction ───────────────────────────────────────────── mcp.NewTool("pinchtab_click", mcp.WithDescription("Click an element by selector (ref from snapshot e.g. 'e5', CSS e.g. 'css:#btn', XPath e.g. 'xpath://button', text e.g. 'text:Submit', or semantic e.g. 'find:login button')"), mcp.WithString("selector", mcp.Required(), mcp.Description("Unified selector: ref (e.g. 'e5'), CSS ('css:#btn' or '#btn'), XPath ('xpath://button'), text ('text:Submit'), or semantic ('find:login button')")), mcp.WithString("ref", mcp.Description("(deprecated) Element ref from snapshot — use 'selector' instead")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_type", mcp.WithDescription("Type text into an input element"), mcp.WithString("selector", mcp.Required(), mcp.Description("Unified selector: ref (e.g. 'e5'), CSS, XPath, text, or semantic")), mcp.WithString("ref", mcp.Description("(deprecated) Element ref from snapshot — use 'selector' instead")), mcp.WithString("text", mcp.Required(), mcp.Description("Text to type")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_press", mcp.WithDescription("Press a keyboard key (Enter, Tab, Escape, etc.)"), mcp.WithString("key", mcp.Required(), mcp.Description("Key to press (e.g., 'Enter', 'Tab', 'Escape')")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_hover", mcp.WithDescription("Hover over an element"), mcp.WithString("selector", mcp.Required(), mcp.Description("Unified selector: ref (e.g. 'e5'), CSS, XPath, text, or semantic")), mcp.WithString("ref", mcp.Description("(deprecated) Element ref from snapshot — use 'selector' instead")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_focus", mcp.WithDescription("Focus an element"), mcp.WithString("selector", mcp.Required(), mcp.Description("Unified selector: ref (e.g. 'e5'), CSS, XPath, text, or semantic")), mcp.WithString("ref", mcp.Description("(deprecated) Element ref from snapshot — use 'selector' instead")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_select", mcp.WithDescription("Select a dropdown option by value"), mcp.WithString("selector", mcp.Required(), mcp.Description("Unified selector for the select element")), mcp.WithString("ref", mcp.Description("(deprecated) Element ref from snapshot — use 'selector' instead")), mcp.WithString("value", mcp.Required(), mcp.Description("Option value to select")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_scroll", mcp.WithDescription("Scroll the page or an element"), mcp.WithString("selector", mcp.Description("Unified selector for element to scroll (omit for page scroll)")), mcp.WithString("ref", mcp.Description("(deprecated) Element ref to scroll — use 'selector' instead")), mcp.WithNumber("pixels", mcp.Description("Number of pixels to scroll (positive=down, negative=up)")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_fill", mcp.WithDescription("Fill an input field directly via JavaScript dispatch"), mcp.WithString("selector", mcp.Required(), mcp.Description("Unified selector: ref (e.g. 'e5'), CSS, XPath, text, or semantic")), mcp.WithString("ref", mcp.Description("(deprecated) Element ref — use 'selector' instead")), mcp.WithString("value", mcp.Required(), mcp.Description("Value to fill")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), // ── Content ───────────────────────────────────────────────── mcp.NewTool("pinchtab_eval", mcp.WithDescription("Execute JavaScript in the browser and return the result"), mcp.WithString("expression", mcp.Required(), mcp.Description("JavaScript expression to evaluate")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_pdf", mcp.WithDescription("Export the current page as a PDF (returns base64-encoded PDF)"), mcp.WithString("tabId", mcp.Description("Target tab ID")), mcp.WithBoolean("landscape", mcp.Description("Landscape orientation")), mcp.WithNumber("scale", mcp.Description("Print scale 0.1-2.0 (default: 1.0)")), mcp.WithString("pageRanges", mcp.Description("Pages to export (e.g., '1-3,5')")), ), mcp.NewTool("pinchtab_find", mcp.WithDescription("Find elements by text content or CSS selector"), mcp.WithString("query", mcp.Required(), mcp.Description("Text or CSS selector to search for")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), // ── Tab Management ────────────────────────────────────────── mcp.NewTool("pinchtab_list_tabs", mcp.WithDescription("List all open browser tabs"), ), mcp.NewTool("pinchtab_close_tab", mcp.WithDescription("Close a browser tab"), mcp.WithString("tabId", mcp.Description("ID of the tab to close")), ), mcp.NewTool("pinchtab_health", mcp.WithDescription("Check PinchTab server health status"), ), mcp.NewTool("pinchtab_cookies", mcp.WithDescription("Get cookies for the current page"), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), mcp.NewTool("pinchtab_connect_profile", mcp.WithDescription("Get the user-facing connect URL and instance status for a profile"), mcp.WithString("profile", mcp.Required(), mcp.Description("Profile name or profile ID")), ), // ── Utility ───────────────────────────────────────────────── mcp.NewTool("pinchtab_wait", mcp.WithDescription("Wait for a specified number of milliseconds"), mcp.WithNumber("ms", mcp.Required(), mcp.Description("Milliseconds to wait (max 30000)")), ), mcp.NewTool("pinchtab_wait_for_selector", mcp.WithDescription("Wait for an element matching a selector to appear on the page"), mcp.WithString("selector", mcp.Required(), mcp.Description("Unified selector to wait for (CSS, XPath, text, or ref)")), mcp.WithNumber("timeout", mcp.Description("Timeout in milliseconds (default: 10000, max: 30000)")), mcp.WithString("tabId", mcp.Description("Target tab ID")), ), } }