Skip to main content
Glama

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
NameRequiredDescriptionDefault
urlYesURL to browse
actionsYesArray of browser action objects (click, type, scroll, etc.)

Implementation Reference

  • 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 }))
    );
  • 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.)"),
  • 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);
      }
    }
  • 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) }] };
    }

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/CSteenkamp/searchclaw-mcp'

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