filesystem

package
v0.59.134 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Filesystem security limits
	DefaultMaxFileSize             = int64(2 * 1024 * 1024 * 1024) // 2GB default file size limit
	DefaultSecureFilePermissions   = 0600                          // Read/write for owner only
	FilesystemMaxFileSizeEnvVar    = "FILESYSTEM_MAX_FILE_SIZE"
	FilesystemSecurePermissionsVar = "FILESYSTEM_SECURE_PERMISSIONS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedDirectoriesResponse

type AllowedDirectoriesResponse struct {
	Directories []string `json:"directories"`
}

AllowedDirectoriesResponse represents the response for listing allowed directories

type DirectoryEntry

type DirectoryEntry struct {
	Name     string           `json:"name"`
	Type     string           `json:"type"` // "file" or "directory"
	Size     int64            `json:"size,omitempty"`
	Modified time.Time        `json:"modified"`
	Children []DirectoryEntry `json:"children,omitempty"` // Only for directories
}

DirectoryEntry represents a single directory entry

type EditFileRequest

type EditFileRequest struct {
	Path   string          `json:"path"`
	Edits  []EditOperation `json:"edits"`
	DryRun bool            `json:"dryRun"`
}

EditFileRequest represents the request for editing a file

type EditOperation

type EditOperation struct {
	OldText string `json:"oldText"`
	NewText string `json:"newText"`
}

EditOperation represents a single edit operation

type FileInfo

type FileInfo struct {
	Size        int64     `json:"size"`
	Created     time.Time `json:"created"`
	Modified    time.Time `json:"modified"`
	Accessed    time.Time `json:"accessed"`
	IsDirectory bool      `json:"isDirectory"`
	IsFile      bool      `json:"isFile"`
	Permissions string    `json:"permissions"`
}

FileInfo represents file metadata

type FileSystemRequest

type FileSystemRequest struct {
	Path string `json:"path"`
}

FileSystemRequest represents the base request structure

type FileSystemTool

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

FileSystemTool implements filesystem operations with directory access control

func (*FileSystemTool) Definition

func (t *FileSystemTool) Definition() mcpapi.Tool

Definition returns the tool's definition for MCP registration

func (*FileSystemTool) Execute

func (t *FileSystemTool) Execute(ctx context.Context, logger *logrus.Logger, cache *sync.Map, args map[string]any) (*mcpapi.CallToolResult, error)

Execute executes the filesystem tool

func (*FileSystemTool) LoadSecurityConfig added in v0.21.2

func (t *FileSystemTool) LoadSecurityConfig()

LoadSecurityConfig loads security configuration (for testing purposes)

func (*FileSystemTool) ProvideExtendedInfo added in v0.22.0

func (t *FileSystemTool) ProvideExtendedInfo() *tools.ExtendedHelp

ProvideExtendedInfo provides detailed usage information for the filesystem tool

func (*FileSystemTool) SetAllowedDirectories

func (t *FileSystemTool) SetAllowedDirectories(dirs []string)

SetAllowedDirectories sets the allowed directories (for testing purposes)

type ListDirectoryRequest

type ListDirectoryRequest struct {
	Path   string `json:"path"`
	SortBy string `json:"sortBy,omitempty"` // "name" or "size"
}

ListDirectoryRequest represents the request for listing directory contents

type MoveFileRequest

type MoveFileRequest struct {
	Source      string `json:"source"`
	Destination string `json:"destination"`
}

MoveFileRequest represents the request for moving/renaming files

type ReadFileRequest

type ReadFileRequest struct {
	Path string `json:"path"`
	Head *int   `json:"head,omitempty"` // Read only first N lines
	Tail *int   `json:"tail,omitempty"` // Read only last N lines
}

ReadFileRequest represents the request for reading a file

type ReadMultipleFilesRequest

type ReadMultipleFilesRequest struct {
	Paths []string `json:"paths"`
}

ReadMultipleFilesRequest represents the request for reading multiple files

type SearchFilesRequest

type SearchFilesRequest struct {
	Path            string   `json:"path"`
	Pattern         string   `json:"pattern"`
	ExcludePatterns []string `json:"excludePatterns"`
}

SearchFilesRequest represents the request for searching files

type WriteFileRequest

type WriteFileRequest struct {
	Path    string `json:"path"`
	Content string `json:"content"`
}

WriteFileRequest represents the request for writing a file

Jump to

Keyboard shortcuts

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