Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v1.151.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package types defines the shared wire contracts for the filesystem tools.

Index

Constants

View Source
const (
	ToolNameReadFile           = "read_file"
	ToolNameReadMultipleFiles  = "read_multiple_files"
	ToolNameEditFile           = "edit_file"
	ToolNameWriteFile          = "write_file"
	ToolNameDirectoryTree      = "directory_tree"
	ToolNameListDirectory      = "list_directory"
	ToolNameSearchFilesContent = "search_files_content"
	ToolNameMkdir              = "create_directory"
	ToolNameRmdir              = "remove_directory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectoryTreeArgs

type DirectoryTreeArgs struct {
	Path string `json:"path" jsonschema:"Directory to traverse"`
}

type DirectoryTreeMeta

type DirectoryTreeMeta struct {
	FileCount int  `json:"fileCount"`
	DirCount  int  `json:"dirCount"`
	Truncated bool `json:"truncated"`
}

type Edit

type Edit struct {
	OldText string `json:"oldText" jsonschema:"Exact text to replace"`
	NewText string `json:"newText" jsonschema:"Replacement text"`
}

type EditFileArgs

type EditFileArgs struct {
	Path  string `json:"path" jsonschema:"File to edit"`
	Edits []Edit `json:"edits" jsonschema:"Edits to apply"`
}

func ParseEditFileArgs

func ParseEditFileArgs(data []byte) (EditFileArgs, error)

ParseEditFileArgs parses LLM-generated edit_file arguments, handling two common failure modes:

  1. The outer JSON itself is malformed — typically extra closing braces/brackets or stray escape sequences caused by the model losing track of nesting depth when the text payload contains structural characters (e.g. YAML, Dockerfiles).
  2. The "edits" field is double-serialized (a JSON string instead of an array).

type ListDirectoryArgs

type ListDirectoryArgs struct {
	Path string `json:"path" jsonschema:"Directory to list"`
}

type ListDirectoryMeta

type ListDirectoryMeta struct {
	Files     []string `json:"files"`
	Dirs      []string `json:"dirs"`
	Truncated bool     `json:"truncated"`
}

type ReadFileArgs

type ReadFileArgs struct {
	Path string `json:"path" jsonschema:"File to read"`
	// Line and Limit are pointers so an omitted value is distinguishable
	// from an explicit (invalid) zero.
	Line  *int `json:"line,omitempty" jsonschema:"1-based line number to start reading from (text files only; defaults to the first line)"`
	Limit *int `` /* 134-byte string literal not displayed */
}

type ReadFileMeta

type ReadFileMeta struct {
	Path      string `json:"path"`
	LineCount int    `json:"lineCount"`
	Error     string `json:"error,omitempty"`
}

type ReadMultipleFilesArgs

type ReadMultipleFilesArgs struct {
	Paths []string `json:"paths" jsonschema:"Files to read"`
	JSON  bool     `json:"json,omitempty" jsonschema:"Return result as JSON"`
}

type ReadMultipleFilesMeta

type ReadMultipleFilesMeta struct {
	Files []ReadFileMeta `json:"files"`
}

type SearchFilesContentArgs

type SearchFilesContentArgs struct {
	Path            string   `json:"path" jsonschema:"Starting directory"`
	Query           string   `json:"query" jsonschema:"Text or regex to search"`
	IsRegex         bool     `json:"is_regex,omitempty" jsonschema:"Treat query as regex"`
	ExcludePatterns []string `json:"excludePatterns,omitempty" jsonschema:"Patterns to exclude"`
}

type SearchFilesContentMeta

type SearchFilesContentMeta struct {
	MatchCount int `json:"matchCount"`
	FileCount  int `json:"fileCount"`
}

type WriteFileArgs

type WriteFileArgs struct {
	Path    string `json:"path" jsonschema:"File to write"`
	Content string `json:"content" jsonschema:"File content"`
}

Jump to

Keyboard shortcuts

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