browse
Automate browser interactions on web pages by performing clicks, form fills, and scrolling actions to gather data or complete tasks programmatically.
Instructions
Interactive browser actions on a URL. Perform clicks, form fills, scrolling, and more. Costs 5 credits.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to browse | |
| actions | Yes | Array of browser action objects (click, type, scroll, etc.) |
Implementation Reference
- src/index.ts:196-204 (handler)Main tool registration for 'browse' - includes the handler function that executes the tool logic: async ({ url, actions }) => jsonResult(await apiPost("/browse", { url, actions })). The tool takes a URL and array of browser action objects, makes a POST request to the /browse API endpoint, and returns the result as formatted JSON.
server.tool( "browse", "Interactive browser actions on a URL. Perform clicks, form fills, scrolling, and more. Costs 5 credits.", { url: z.string().describe("URL to browse"), actions: z.array(z.record(z.unknown())).describe("Array of browser action objects (click, type, scroll, etc.)"), }, async ({ url, actions }) => jsonResult(await apiPost("/browse", { url, actions })) ); - src/index.ts:200-201 (schema)Input schema definition for the browse tool using Zod: url (string) and actions (array of records containing unknown values). Defines the structure for browser action objects like click, type, scroll, etc.
url: z.string().describe("URL to browse"), actions: z.array(z.record(z.unknown())).describe("Array of browser action objects (click, type, scroll, etc.)"), - src/index.ts:41-59 (helper)Helper function apiPost() that makes POST requests to the SearchClaw API. Used by the browse tool handler to send the URL and actions to the /browse endpoint. Includes timeout handling and error management.
async function apiPost(path: string, body: Record<string, unknown>) { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 30000); try { const response = await fetch(`${API_BASE}${path}`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify(body), signal: controller.signal, }); if (!response.ok) { const text = await response.text(); throw new Error(`SearchClaw API error ${response.status}: ${text}`); } return response.json(); } finally { clearTimeout(timeout); } } - src/index.ts:61-63 (helper)Helper function jsonResult() that formats the API response as MCP tool output. Converts the data to formatted JSON text and wraps it in the required MCP content structure.
function jsonResult(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }