Documentation
¶
Overview ¶
Package filereadtool implements the FileRead tool — reads a file from the local filesystem and returns its contents with line numbers. Mirrors src/tools/FileReadTool/FileReadTool.ts.
M2 scope: text files only (UTF-8), line-number prefix, offset/limit pagination, binary-file detection, max read size (MaxReadBytes). PDF, image, and skills side-effects land in later milestones.
Index ¶
Constants ¶
const MaxLines = 2000
MaxLines is the maximum number of lines we'll return when no limit is specified (avoids blowing up context on huge files).
const MaxReadBytes = 2 * 1024 * 1024
MaxReadBytes is the maximum file size we'll read in one call.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Input ¶
type Input struct {
FilePath string `json:"file_path"`
Offset int `json:"offset,omitempty"` // 1-indexed line number to start reading from
Limit int `json:"limit,omitempty"` // number of lines to read
}
Input is the typed view of the JSON input.
type Tool ¶
type Tool struct{}
Tool implements the Read tool.
func (*Tool) Description ¶
Description is the prompt text the model sees.
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: reads are safe to run concurrently.
func (*Tool) IsReadOnly ¶
func (*Tool) IsReadOnly(json.RawMessage) bool
IsReadOnly: reading a file is always read-only.