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:
- the output format is JSON, not a plain text
- the output of SearchFileContent always corresponds to `git grep -n --no-index`
- RunShellCommandParams.Command is a string slice, not a string
- RunShellCommandParams.Directory is an absolute path, not a relative path
- RunShellCommandParams.Directory must not be empty
Eventually, this package may be split to a separate repository.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Glob = &mcp.Tool{
Name: "glob",
Description: `Finds files matching specific glob patterns (e.g., src/**/*.ts, *.md)`,
}
var ListDirectory = &mcp.Tool{
Name: "list_directory",
Description: `Lists the names of files and subdirectories directly within a specified directory path.`,
}
var ReadFile = &mcp.Tool{
Name: "read_file",
Description: `Reads and returns the content of a specified file.`,
}
var RunShellCommand = &mcp.Tool{
Name: "run_shell_command",
Description: `Executes a given shell command.`,
}
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'.`,
}
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 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 RunShellCommandParams ¶
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."` }