Skip to main content
Glama

e2b_run_command

Execute a command inside an E2B sandbox and capture its output, errors, and exit code within a set timeout to verify behavior or retrieve results.

Instructions

Run a command in a sandbox and wait (up to timeoutMs) for it to finish, returning collected stdout/stderr/exit status. Uses the streaming process.Process/Start RPC under the hood.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cmdYesExecutable to run, e.g. 'bash'
cwdNo
argsNoArguments, e.g. ['-lc', 'echo hi']
envsNo
portNoOptional envd port; defaults to 49983
usernameNo
sandboxIdYesE2B sandbox ID
timeoutMsNoHow long to wait for the command to finish before returning partial output
accessTokenNoOptional sandbox access token
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses the wait-up-to-timeoutMs behavior, the collected outputs (stdout/stderr/exit status), and the underlying streaming RPC. However, with no annotations, it does not warn about potential side effects, permission requirements, or behavior on timeout/non-zero exit. The transparency is partial and lacks caveats that could affect the agent's decision to call it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loading the core action and output, with the second sentence adding a useful technical detail about the RPC. It is succinct, avoids redundancy, and includes no filler. The structure is efficient, though slightly under-specified for the parameter complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the 9 parameters, no output schema, and no annotations, the description alone is insufficient for correct invocation in all cases. It does not explain error handling, how to construct argument arrays, or the meaning of cwd/envs/username. It also omits guidance on when to use this vs interactive process tools, leaving gaps that could lead to misusage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 67%, with several parameters (cmd, args, port, sandboxId, timeoutMs, accessToken) already having descriptions, but cwd, envs, and username lack schema descriptions. The tool description does not add any clarification for those undocumented parameters and only indirectly mentions timeoutMs. It adds no value beyond the schema, so parameters like envs and username remain ambiguous for the agent.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Run') and resource ('command in a sandbox'), and explicitly describes the wait-and-collect behavior and return values (stdout/stderr/exit status). This clearly differentiates it from sibling tools like e2b_list_dir (directory listing) and e2b_send_stdin (interactive input), which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention conditions for choosing this over e2b_send_stdin for interactive processes or e2b_list_processes for process monitoring. The description only states what it does, leaving decision-making to the agent with no explicit exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/contributory/e2b-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server