msi

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 3 Imported by: ? 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

Overview

Package msi provides the "MCP Sandbox Interface" (tentative) that should be reusable for other projects too.

MCP Sandbox Interface defines MCP (Model Context Protocol) tools that can be used for reading, writing, and executing local files with an appropriate sandboxing technology. The sandboxing technology can be more secure and/or efficient than the default tools provided by an AI agent.

MCP Sandbox Interface was inspired by Gemini CLI's built-in tools. https://github.com/google-gemini/gemini-cli/tree/v0.1.12/docs/tools

Notable differences from Gemini CLI's built-in tools:

Eventually, this package may be split to a separate repository.

Index

Constants

This section is empty.

Variables

View Source
var Glob = &mcp.Tool{
	Name:        "glob",
	Description: `Finds files matching specific glob patterns (e.g., src/**/*.ts, *.md)`,
}
View Source
var ListDirectory = &mcp.Tool{
	Name:        "list_directory",
	Description: `Lists the names of files and subdirectories directly within a specified directory path.`,
}
View Source
var ReadFile = &mcp.Tool{
	Name:        "read_file",
	Description: `Reads and returns the content of a specified file.`,
}
View Source
var Replace = &mcp.Tool{
	Name:        "replace",
	Description: `Replaces text within a file. By default, replaces a single occurrence, but can replace multiple occurrences when expected_replacements is specified. This tool is designed for precise, targeted changes and requires significant context around the old_string to ensure it modifies the correct location.`,
}
View Source
var RunShellCommand = &mcp.Tool{
	Name:        "run_shell_command",
	Description: `Executes a given shell command.`,
}
View Source
var SearchFileContent = &mcp.Tool{
	Name:        "search_file_content",
	Description: `Searches for a regular expression pattern within the content of files in a specified directory. Internally calls 'git grep -n --no-index'.`,
}
View Source
var WriteFile = &mcp.Tool{
	Name:        "write_file",
	Description: `Writes content to a specified file. If the file exists, it will be overwritten. If the file doesn't exist, it (and any necessary parent directories) will be created.`,
}

Functions

This section is empty.

Types

type GlobParams

type GlobParams struct {
	Pattern string  `json:"pattern" jsonschema:"The glob pattern to match against (e.g., '*.py', 'src/**/*.js')."`
	Path    *string `` /* 135-byte string literal not displayed */

}

type GlobResult

type GlobResult struct {
	Matches []string `json:"matches" jsonschema:"A list of absolute file paths that match the provided glob pattern."`
}

type ListDirectoryParams

type ListDirectoryParams struct {
	Path string `json:"path" jsonschema:"The absolute path to the directory to list."`
}

type ListDirectoryResult

type ListDirectoryResult struct {
	Entries []ListDirectoryResultEntry `json:"entries" jsonschema:"The directory content entries."`
}

type ListDirectoryResultEntry

type ListDirectoryResultEntry struct {
	Name    string       `json:"name" jsonschema:"base name of the file"`
	Size    *int64       `json:"size,omitempty" jsonschema:"length in bytes for regular files; system-dependent for others"`
	Mode    *fs.FileMode `json:"mode,omitempty" jsonschema:"file mode bits"`
	ModTime *time.Time   `json:"time,omitempty" jsonschema:"modification time"`
	IsDir   *bool        `json:"is_dir,omitempty" jsonschema:"true for a directory"`
}

ListDirectoryResultEntry is similar to io/fs.FileInfo.

type ReadFileParams

type ReadFileParams struct {
	Path string `json:"path" jsonschema:"The absolute path to the file to read."`
}

type ReadFileResult

type ReadFileResult struct {
	Content string `json:"content" jsonschema:"The content of the file."`
}

type ReplaceParams added in v2.3.0

type ReplaceParams struct {
	Path                 string `json:"path" jsonschema:"The absolute path to the file to modify."`
	OldString            string `` /* 282-byte string literal not displayed */
	NewString            string `json:"new_string" jsonschema:"The exact literal text to replace old_string with."`
	ExpectedReplacements *int   `json:"expected_replacements,omitempty" jsonschema:"The number of occurrences to replace. Defaults to 1."`
}

type ReplaceResult added in v2.3.0

type ReplaceResult struct {
	Replacements int `json:"replacements" jsonschema:"The number of occurrences that were replaced."`
}

type RunShellCommandParams

type RunShellCommandParams struct {
	Command     []string `` /* 160-byte string literal not displayed */
	Description string   `` /* 132-byte string literal not displayed */
	Directory   string   `` /* 177-byte string literal not displayed */
}

type RunShellCommandResult

type RunShellCommandResult struct {
	Stdout   string `json:"stdout" jsonschema:"Output from the standard output stream."`
	Stderr   string `json:"stderr" jsonschema:"Output from the standard error stream."`
	Error    string `json:"error,omitempty" jsonschema:"Any error message reported by the subprocess."`
	ExitCode *int   `json:"exit_code,omitempty" jsonschema:"Exit code of the command."`
}

type SearchFileContentParams

type SearchFileContentParams struct {
	Pattern string  `json:"pattern" jsonschema:"The regular expression (regex) to search for (e.g., 'function\\s+myFunction')."`
	Path    *string `` /* 130-byte string literal not displayed */
	Include *string `` /* 185-byte string literal not displayed */
}

type SearchFileContentResult

type SearchFileContentResult struct {
	GitGrepOutput string `` /* 152-byte string literal not displayed */
}

type WriteFileParams

type WriteFileParams struct {
	Path    string `json:"path" jsonschema:"The absolute path to the file to write to."`
	Content string `json:"content" jsonschema:"The content to write into the file."`
}

type WriteFileResult

type WriteFileResult struct {
}

Jump to

Keyboard shortcuts

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