> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useagents.site/llms.txt
> Use this file to discover all available pages before exploring further.

# test_tool

> Use the `test_tool` MCP tool to install named packages and run agent-authored files in a UseAgents sandbox.

Use `test_tool` after `get_tool_context` or `search_docs` when you have written a small program and want to know if it installs and runs. The snippet runs in a UseAgents sandbox, not on the user's machine.

<Info>
  Pass config and secrets through optional `env` as `{ name, value?, secret? }`. Each item needs a `value` or a `secret`. Logs store env names only. The sandbox allows outbound network so live vendor API calls can run. JavaScript and TypeScript (`runtime: node`) use the Bun runtime to add packages and run files. Pass `sessionId` from a previous result to reuse the same sandbox. The box is paused between runs and has no hard TTL.
</Info>

## Parameters

| Parameter   | Type      | Required | Description                                                                             |
| ----------- | --------- | -------- | --------------------------------------------------------------------------------------- |
| `language`  | string    | Yes      | Snippet language, for example `typescript` or `python`                                  |
| `runtime`   | string    | Yes      | `node`, `python`, `golang`, `ruby`, or `rust`                                           |
| `files`     | array     | Yes\*    | Objects with `path` and `code`. Required unless `sessionId` is set                      |
| `packages`  | string\[] | No       | Package names to install                                                                |
| `entry`     | string    | No       | File to run. Defaults to the first file. Required when `files` is empty                 |
| `sessionId` | string    | No       | Previous `test_tool` session. Reuses packages and files; the box is paused between runs |
| `slug`      | string    | No       | Registry slug this snippet is testing                                                   |
| `env`       | array     | No       | Optional `{ name, value?, secret? }` pairs. Omit or pass `[]` for none                  |
| `timeoutMs` | number    | No       | 1000–60000, default 30000                                                               |
| `format`    | string    | No       | `toon` (default) or `json`                                                              |

## Example call

```json theme={null}
{
  "slug": "resend",
  "language": "typescript",
  "runtime": "node",
  "packages": ["resend"],
  "env": [{ "name": "RESEND_API_KEY", "secret": "re_test" }],
  "files": [
    {
      "path": "src/index.ts",
      "code": "import { Resend } from \"resend\";\nconsole.log(typeof new Resend(\"re_test\").emails.send);\n"
    }
  ]
}
```

## Related

* [Tools Test API](/api-reference/tools-test)
* [MCP tools introduction](/mcp/tools-reference/introduction)
