Documentation
¶
Overview ¶
Package urlfetch provides an Eino-compatible tool for fetching the raw text content of a file:// or https:// URL.
Unlike the fileops tools, urlfetch intentionally reaches outside any workspace boundary. The canonical use case is loading documentation assets from absolute filesystem paths (e.g. ~/docs/learning-output-style/index.html) or from HTTPS endpoints. The absence of workspace containment is deliberate; reviewers should not flag it as an oversight.
Result preserves the original decoded JSON object in RawJSON so consumers can inspect unknown top-level fields added by future versions. RawJSON is never emitted when marshaling results produced by this package.
Index ¶
Constants ¶
const ( ErrCategoryValidation = "validation" ErrCategoryNotFound = "not_found" ErrCategoryIO = "io" ErrCategoryNetwork = "network" ErrCategoryCanceled = "canceled" ErrCategoryUnknown = "unknown" )
const Name = "url_fetch"
Name is the model-facing tool name.
Variables ¶
This section is empty.
Functions ¶
func Schema ¶
func Schema() json.RawMessage
Schema returns a fresh JSON Schema copy for urlfetch arguments.
Types ¶
type Args ¶
type Args struct {
URL string `json:"url"`
}
Args is the parsed input shape for the tool.
type Options ¶
type Options struct {
// HTTPClient overrides the default HTTP client used for https:// requests.
// If nil, a client with a 30-second timeout is used.
HTTPClient *http.Client
}
Options configures urlfetch tool behavior that is intentionally owned by the caller rather than hidden inside the tool.
type Result ¶
type Result struct {
Outcome result.Outcome `json:"outcome"`
Content string `json:"content,omitempty"`
Error *ResultError `json:"error,omitempty"`
RawJSON json.RawMessage `json:"-"`
}
Result is the structured envelope returned to the model.
func (Result) IsRetryable ¶
IsRetryable reports whether the agent loop should retry the same call.
func (*Result) UnmarshalJSON ¶
UnmarshalJSON decodes Result and preserves the original object in RawJSON.
type ResultError ¶
ResultError is the structured failure envelope nested inside Result.