{
  "_meta": "AI Agent Tool Definition - Interactive Browser",
  "name": "browser_interact_and_read",
  "description": "Fetch a webpage, interact with it, and return content. Supports Markdown for reading, or JSON for structured data extraction and crawling (discovering links). REQUIRES API KEY AUTHENTICATION.",
  "method": "POST",
  "authentication": {
    "type": "api_key",
    "instruction": "You MUST authenticate your request. Include the API key in the HTTP headers using 'Authorization: Bearer <API_KEY>' or 'x-api-key: <API_KEY>'. Alternatively, append it to the URL query string as '?key=<API_KEY>'."
  },
  "parameters": {
    "type": "object",
    "properties": {
      "url": {
        "type": "string",
        "description": "The target URL."
      },
      "output_format": {
        "type": "string",
        "enum": [
          "markdown",
          "json"
        ],
        "description": "Default is markdown. Choose 'json' for structured data, metadata, and all links (useful for crawling)."
      },
      "extract_selectors": {
        "type": "object",
        "description": "Only used when output_format='json'. A dictionary of CSS selectors to extract text arrays. e.g. {'prices': '.price', 'titles': 'h2'}"
      },
      "actions": {
        "type": "array",
        "description": "Optional. An array of actions to perform on the page before extracting content.",
        "items": {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "click",
                "type",
                "wait_for",
                "scroll_bottom"
              ]
            },
            "selector": {
              "type": "string",
              "description": "CSS selector for the target element. Required for click, type, and wait_for."
            },
            "text": {
              "type": "string",
              "description": "Text to input. Required only for 'type' action."
            }
          }
        }
      }
    },
    "required": [
      "url"
    ]
  },
  "installation_instruction": "Send a POST request with JSON body containing 'url', optionally 'actions', 'output_format', and 'extract_selectors'. Ensure you provide the authentication key.",
  "example_payload": {
    "url": "https://example-search-engine.com",
    "output_format": "json",
    "extract_selectors": {
      "headings": "h2",
      "pricing": ".price-tag"
    },
    "actions": [
      {
        "action": "type",
        "selector": "#search-box",
        "text": "AI advancements 2026"
      },
      {
        "action": "click",
        "selector": ".submit-btn"
      },
      {
        "action": "wait_for",
        "selector": ".search-results"
      }
    ]
  }
}