API: @loopstack/web
Classes
WebFetchTool
Tool that fetches a URL, converts HTML to Markdown, and optionally summarizes the content through the configured
LLM provider (model claude-haiku-4-5-20251001 by default). A summarized result carries the provider, model and token usage as LlmResultMeta.
import { WebFetchTool } from '@loopstack/web';Provided by: WebModule
export class WebFetchTool extends BaseTool<WebFetchArgs, object, WebFetchResult, Partial<LlmResultMeta>> { protected handle(args: WebFetchArgs, ctx: RunContext): Promise<ToolEnvelope<WebFetchResult, Partial<LlmResultMeta>>>;}WebModule
NestJS module that provides the web_fetch tool (WebFetchTool) and its supporting services —
fetches a URL, converts HTML to Markdown, and optionally summarizes the content with the configured LLM provider.
Registration:
WebModule— bare import; registers theWebFetchTooland the fetcher, Markdown, and summarizer services. There are no static configuration methods.
Requires: LlmProviderModule imported alongside it (the summarizer resolves its provider from the
global LlmProviderRegistry). The optional summarization step (triggered when a prompt arg is
passed) also needs a provider module such as ClaudeModule or OpenAiModule and its API key. It
uses the tool’s provider arg, else the LlmProviderModule default provider, else claude, and
the tool’s model arg, else CLAUDE_WEB_FETCH_MODEL, else claude-haiku-4-5-20251001 — pass model
when summarizing with a provider other than claude.
import { WebModule } from '@loopstack/web';export class WebModule {}Interfaces
WebFetchResult
Result for WebFetchTool — the fetched URL, response metadata, the Markdown or summarized content, and optional redirect details.
import { WebFetchResult } from '@loopstack/web';export interface WebFetchResult { url: string; bytes: number; code: number; codeText: string; contentType: string; result: string; truncated: boolean; cached: boolean; durationMs: number; redirect?: { originalUrl: string; redirectUrl: string; statusCode: number; };}Type Aliases
WebFetchArgs
Args for WebFetchTool.
import { WebFetchArgs } from '@loopstack/web';export type WebFetchArgs = z.infer<typeof WebFetchSchema>;Variables
WebFetchResultSchema
Zod schema for WebFetchResult.
import { WebFetchResultSchema } from '@loopstack/web';WebFetchResultSchema: z.ZodObject< { url: z.ZodString; bytes: z.ZodNumber; code: z.ZodNumber; codeText: z.ZodString; contentType: z.ZodString; result: z.ZodString; truncated: z.ZodBoolean; cached: z.ZodBoolean; durationMs: z.ZodNumber; redirect: z.ZodOptional< z.ZodObject< { originalUrl: z.ZodString; redirectUrl: z.ZodString; statusCode: z.ZodNumber; }, z.core.$strict > >; }, z.core.$strict>;WebFetchSchema
Zod schema for WebFetchTool arguments.
import { WebFetchSchema } from '@loopstack/web';WebFetchSchema: z.ZodObject< { url: z.ZodURL; prompt: z.ZodOptional<z.ZodString>; provider: z.ZodOptional<z.ZodString>; model: z.ZodOptional<z.ZodString>; envApiKey: z.ZodOptional<z.ZodString>; maxTokens: z.ZodOptional<z.ZodNumber>; }, z.core.$strict>;