Skip to content
AgentsWeb fetch toolMenu

Web fetch tool

A page fetch: the address, the page title and an excerpt of what the agent read.

The page title, its address and what the agent read.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/tool-web-fetch.json

Usage

tsx
import { ToolWebFetch } from "@/components/ui/chatcn/tool-web-fetch"

<ToolWebFetch state="output-available" url={url} pageTitle={title} excerpt={text} />
tsx
import { ToolWebFetchPart, toolWebFetchRenderers } from "@/components/ui/chatcn/tool-web-fetch"

// One part straight from AI SDK or the chatcn contract
<ToolWebFetchPart part={part} onApprove={approve} onDeny={deny} />

// Or map tool names to renderers for a whole message
renderToolPart(part, { ...toolWebFetchRenderers })

Props

PropTypeNotes
urlstringHost and path go in the header
pageTitlestringTitle of the fetched page
excerptstringWhat the agent read. Clamped to six lines
statusnumberHTTP status. Shown in the header when not 2xx
stateToolDisplayStateThe ToolCall lifecycle: streaming, running, approval, output, error, denied, cancelled
approval, decisionApproval request and the user's answer, as on ToolCall
onApprove, onDeny, onRetrySame callbacks as ToolCall
errorTextReactNodeShown on output-error
durationMs, startedAtnumberOptional. Measured automatically when omitted
variant"card" | "inline"Inline sits on a trace rail
open, defaultOpen, onOpenChangeControlled or uncontrolled details

Keyboard

KeyAction
Enter, SpaceExpand or collapse the details
TabMove through the header, links, copy buttons and approval actions

Motion

  • Inherits ToolCall: the status glyph swaps with a 150 ms blur crossfade and details open over 200 ms.
  • Nothing inside the body animates. Under reduced motion everything snaps.