Skip to main content

Module folder

Module folder 

Source
Expand description

The root folders and the seven operations on them.

Folder holds each root opened as a cap_std::fs::Dir. Every file operation goes through one of those handles with a root-relative path, so the operating system (via cap-std) refuses anything that would resolve outside that root: absolute paths, .., and symlinks pointing out, including symlinks from one root into another. Listing and search walk with the ignore crate (ripgrep’s walker, .gitignore and hidden-file aware, symlinks not followed); each path the walker yields is made relative to its root and re-opened through the Dir, never by its absolute path, so an entry swapped for an escaping symlink mid-walk is skipped rather than read.

With one root, tool paths are plain root-relative paths. With several, a tool path starts with the root’s name (docs/guide.md), and . is a virtual folder holding the roots.

The operations are synchronous; the MCP layer runs them on the blocking pool.

Structs§

Config
What the operator configured at start-up.
Folder
The root folders, opened once, and the operator’s limits.
RootSpec
One root folder as the operator named it: DIR or NAME=DIR.

Enums§

ReadOutput
Result of read.
WriteMode
How write treats an existing file.

Constants§

DEFAULT_MAX_CHARS
Default for Config::max_chars: emperor-mcp’s default output cap.
DEFAULT_MAX_FILE_BYTES
Default for Config::max_file_bytes: 1 MiB.
DEFAULT_MAX_RESULTS
Default for Config::max_results.
MAX_IMAGE_BYTES
Largest image read returns as image content: 5 MiB.