Documentation
¶
Index ¶
- Constants
- type Cache
- type Config
- type FetchedContent
- type HTTPClient
- type Input
- type Output
- type RedirectInfo
- type Tool
- func (t *Tool) BackfillInput(ctx context.Context, input map[string]any) map[string]any
- func (t *Tool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *Tool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (t *Tool) Definition() tool.Definition
- func (t *Tool) Description(ctx context.Context) (string, error)
- func (t *Tool) FormatResult(data any) string
- func (t *Tool) IsConcurrencySafe(input map[string]any) bool
- func (t *Tool) IsEnabled() bool
- func (t *Tool) IsReadOnly(input map[string]any) bool
- func (t *Tool) PreparePermissionMatcher(ctx context.Context, input map[string]any) (func(string) bool, error)
- func (t *Tool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
Constants ¶
const Description = `` /* 2114-byte string literal not displayed */
Description is the tool description.
const MaxPromptPreviewLength = 4000
MaxPromptPreviewLength limits the amount of source content included in the extracted result.
const SearchHint = "fetch web pages and extract information"
const ToolName = "web_fetch"
ToolName is the tool name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
func DefaultCache ¶
func DefaultCache() *Cache
DefaultCache keeps the old wrapper-level constructor available while delegating to the shared fetch core.
type Config ¶
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the shared fetch-core defaults through the tool package for backward compatibility.
func DefaultToolConfig ¶
func DefaultToolConfig() *Config
DefaultToolConfig returns default configuration.
type FetchedContent ¶
type FetchedContent = fetchcore.FetchedContent
type HTTPClient ¶
type HTTPClient = fetchcore.HTTPClient
type Input ¶
type Input struct {
URL string `json:"url"`
Prompt string `json:"prompt"`
RenderMode string `json:"render_mode,omitempty"`
}
Input represents the tool input.
type Output ¶
type Output struct {
Bytes int `json:"bytes"`
Code int `json:"code"`
CodeText string `json:"codeText"`
Result string `json:"result"`
DurationMs int64 `json:"durationMs"`
URL string `json:"url"`
Mode string `json:"mode,omitempty"`
PersistedPath string `json:"persisted_path,omitempty"`
PersistedSize int `json:"persisted_size,omitempty"`
}
Output represents the tool output.
type RedirectInfo ¶
type RedirectInfo = fetchcore.RedirectInfo
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool represents the WebFetch tool.
func (*Tool) BackfillInput ¶
BackfillInput adds derived fields so downstream permission and transcript code sees normalized values.
func (*Tool) Call ¶
func (t *Tool) Call( ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn, ) (tool.CallResult, error)
Call executes the tool end-to-end while keeping the orchestration logic separate from the fetch backends.
func (*Tool) CheckPermissions ¶
func (t *Tool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
func (*Tool) Definition ¶
func (t *Tool) Definition() tool.Definition
Definition returns the tool definition.
func (*Tool) Description ¶
Description returns human-readable description.
func (*Tool) FormatResult ¶
FormatResult serialises the tool output into the tool_result content string.
func (*Tool) IsConcurrencySafe ¶
IsConcurrencySafe reports that WebFetch requests can run concurrently.
func (*Tool) IsReadOnly ¶
IsReadOnly reports that WebFetch does not modify state.