write

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(registry *tool.Registry, opts ...Option) error

Register creates a WriteTool and registers it in the given registry.

Types

type Option

type Option func(*WriteTool)

Option is a functional option for configuring a WriteTool.

func WithAllowedDirs

func WithAllowedDirs(dirs ...string) Option

WithAllowedDirs sets the allowed base directories for the write tool. Uses ValidatePath semantics; for TOCTOU-safe enforcement prefer WithPathGuard.

func WithMaxWriteBytes

func WithMaxWriteBytes(n int) Option

WithMaxWriteBytes sets the maximum number of bytes that can be written.

func WithPathGuard

func WithPathGuard(g *toolkit.PathGuard) Option

WithPathGuard installs a PathGuard which bounds writes to its roots.

type WriteTool

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

WriteTool holds configuration for the built-in file write tool.

func New

func New(opts ...Option) *WriteTool

New creates a WriteTool with the given options.

func (*WriteTool) Handler

func (wt *WriteTool) Handler() tool.ToolHandler

Handler returns the ToolHandler closure for this write tool.

func (*WriteTool) ToolDef

func (wt *WriteTool) ToolDef() schema.ToolDef

ToolDef returns the schema.ToolDef for registration.

Jump to

Keyboard shortcuts

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