openurl

package
v1.93.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package openurl implements a built-in toolset that exposes a single tool which opens a fixed URL in the user's default browser. The URL is baked into the toolset definition (the YAML `url` field), so the model only has to call the tool by name — it never supplies the URL itself.

Opening the URL is delegated to pkg/browser, which picks the right platform helper (open / xdg-open / rundll32), so the tool works across macOS, Linux and Windows.

Index

Constants

View Source
const ToolNameOpenURL = "open_url"

Variables

This section is empty.

Functions

func CreateToolSet

func CreateToolSet(toolset latest.Toolset, runConfig *config.RuntimeConfig) (tools.ToolSet, error)

CreateToolSet is used by the tools registry.

Types

type Option

type Option func(*ToolSet)

func WithExpander

func WithExpander(expander *js.Expander) Option

WithExpander enables ${env.X} interpolation of the configured URL.

func WithName

func WithName(name string) Option

WithName overrides the tool name. An empty name keeps the default.

func WithOpener

func WithOpener(open func(context.Context, string) error) Option

WithOpener overrides the function used to open the URL. Tests use it to avoid spawning a real browser.

type ToolSet

type ToolSet struct {
	// contains filtered or unexported fields
}

func New

func New(url string, opts ...Option) *ToolSet

func (*ToolSet) Instructions

func (t *ToolSet) Instructions() string

func (*ToolSet) Tools

func (t *ToolSet) Tools(context.Context) ([]tools.Tool, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL