Web Toolset#

Generated byAI

This toolset provides tools for interacting with web resources via HTTP requests.

http_get_text_tool#

Makes an HTTP GET request to a given URL that returns text content, and returns the content type and content.

Parameters#

Parameter Type Required Description
url String Yes The URL to GET text from.
user_agent String No Optional user agent header; default is Firefox for macOS.
preserve_html Boolean No Optional flag to preserve all the HTML content; default is false.
accept String No Optionally specify an acceptable content type (e.g. text/markdown) to ask the server for specific format. Default is none.

Success Case Examples#

Input:

{
  "url": "https://example.com",
  "user_agent": "MyCustomAgent/1.0",
  "preserve_html": false,
  "accept": "text/html"
}

Output:

{
  "content_type": "text/html",
  "body": "<html>...reduced HTML content...</html>"
}

Error Case Examples#

  1. Missing URL:

    {
      "error": "The required URL was not specified"
    }
  2. Non-text Content:

    {
      "error": "HTTP request did not return text content; it's content type was: image/png"
    }
  3. HTTP Request Failed:

    {
      "error": "HTTP request failed with status: 404"
    }
  4. Content Too Large:

    {
      "error": "Received content > 256000. Response is too big."
    }
  5. Network Error:

    {
      "error": "An error occurred while making the HTTP request: Connection refused"
    }

Notes#

  • The tool strips line indents and coalesces line breaks for HTML, JSON, and XML content.
  • Unless preserve_html is set to true, it removes the head, script, and style elements as well as all class attributes from HTML content.
  • The maximum allowed content size is 256KB. Larger responses will result in an error.