filewritetool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package filewritetool implements the Write tool — writes a file to the local filesystem. Mirrors src/tools/FileWriteTool/FileWriteTool.ts.

M2 scope: create new files and overwrite existing ones (UTF-8, LF line endings). Parent directory creation, LSP notification, and the file-history side-effects land in later milestones.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	FilePath string `json:"file_path"`
	Content  string `json:"content"`
}

Input is the typed view of the JSON input.

type Tool

type Tool struct{}

Tool implements the Write tool.

func New

func New() *Tool

New returns a fresh FileWrite tool.

func (*Tool) Description

func (*Tool) Description() string

Description is the prompt text the model sees.

func (*Tool) Execute

func (t *Tool) Execute(ctx context.Context, raw json.RawMessage) (tool.Result, error)

Execute writes the given content to the given file path.

func (*Tool) InputSchema

func (*Tool) InputSchema() json.RawMessage

InputSchema is the JSON Schema sent to the model.

func (*Tool) IsConcurrencySafe

func (*Tool) IsConcurrencySafe(json.RawMessage) bool

IsConcurrencySafe: concurrent writes to the same path are unsafe.

func (*Tool) IsReadOnly

func (*Tool) IsReadOnly(json.RawMessage) bool

IsReadOnly: writing a file is never read-only.

func (*Tool) Name

func (*Tool) Name() string

Name implements tool.Tool.

Jump to

Keyboard shortcuts

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