Tool for making HTTP requests to external APIs and web services

Hierarchy (view full)

Constructors

Properties

name: string

Name of the tool

description: string

Description of the tool

isLongRunning: boolean

Whether the tool is a long running operation, which typically returns a resource id first and finishes the operation later.

shouldRetryOnFailure: boolean

Whether the tool execution should be retried on failure

maxRetryAttempts: number

Maximum retry attempts

baseRetryDelay: number = 1000

Base delay for retry in ms (will be used with exponential backoff)

maxRetryDelay: number = 10000

Maximum delay for retry in ms

logger: Logger = ...

Accessors

Methods

  • Processes the outgoing LLM request for this tool.

    Use cases:

    • Most common use case is adding this tool to the LLM request.
    • Some tools may just preprocess the LLM request before it's sent out.

    Parameters

    Returns Promise<void>

  • Execute the HTTP request

    Parameters

    • args: {
          url: string;
          method?: string;
          headers?: Record<string, string>;
          body?: string;
          params?: Record<string, string>;
          timeout?: number;
      }
      • url: string
      • Optionalmethod?: string
      • Optionalheaders?: Record<string, string>
      • Optionalbody?: string
      • Optionalparams?: Record<string, string>
      • Optionaltimeout?: number
    • _context: ToolContext

    Returns Promise<HttpRequestResult>