Skip to main content

Module sandbox

Module sandbox 

Source
Expand description

Optional confinement of file access to one directory, for the MCP server.

An agent may be steered by the documents it reads. With a root set, no tool can be talked into reading or writing outside of it.

Constants§

PATH_KEYS
Argument names that hold file or directory paths, in any tool.

Functions§

active
check
Fails if a root is set and path lies outside it.
check_args
Checks every path argument of a tool call.
set_root
Confines all later tool calls to dir, and resolves relative paths against it.
within
Fails unless path lies inside root, which must be canonical.