A client-declared MCP filesystem root.
MCP 2025-11-25 restricts roots to file:// URIs. This module normalizes
those URIs before they enter session state and provides boundary checks that
compare complete path segments rather than unsafe string prefixes.
contains?/2 is a URI-level check and does not access the local filesystem.
Use safe_realpath/2 when a root refers to the server's local filesystem and
symlink-aware containment is required.
Summary
Functions
Returns whether a file URI is equal to or below the supplied root.
Builds a canonical file root from a local absolute or relative path.
Builds and validates a canonical root, raising on invalid input.
Parses a root URI or tagged-schema root map.
Returns the decoded, normalized absolute path represented by a root.
Resolves a local path and verifies symlink-aware containment in the root.
Returns the tagged MCP wire representation.
Types
Functions
Returns whether a file URI is equal to or below the supplied root.
Builds a canonical file root from a local absolute or relative path.
Builds and validates a canonical root, raising on invalid input.
Parses a root URI or tagged-schema root map.
Returns the decoded, normalized absolute path represented by a root.
Resolves a local path and verifies symlink-aware containment in the root.
Returns the tagged MCP wire representation.