Skip to content

Code Execution API

Code Execution Server

doc_processing_std_tools.code_execution

Code Execution tools MCP server.

Provides a persistent bash session for running shell commands. The session maintains state (working directory) across calls. Each execute_command invocation runs in a subprocess that inherits the tracked working directory, so cd in one call is reflected in subsequent calls. Call restart_session to reset the working directory to its initial value.

The primary security boundary is the Docker container the agent runs in.

execute_command(command, timeout=None)

Execute a shell command in the persistent bash session.

The session preserves the working directory across calls — if you cd into a directory, subsequent commands will run there until restart_session is called. The primary security boundary is the Docker container the agent runs in.

Parameters:

Name Type Description Default
command str

Shell command to execute. Supports pipes, redirects, and chained commands (&&, ||, ;).

required
timeout int | None

Execution timeout in seconds. Defaults to the DPTTOOLS_SANDBOX_TIMEOUT environment variable (30 s).

None

Returns:

Type Description
str

JSON string with keys stdout, stderr, exit_code

str

(int), and timed_out (bool).

restart_session()

Reset the persistent bash session.

Resets the working directory back to the initial value it had when the server started.

Returns:

Type Description
str

Confirmation message including the reset working directory path.