createSession
Creates a CodeSandbox session for a target sandbox and returns a session ID without storing state on the server. Use it to inject environment variables, Git identity, and read/write permissions.
Instructions
Create a CodeSandbox session for a sandbox. Returns the sessionId without storing state on the server.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sandboxId": "<sandboxId>"
},
"name": "createSession"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Environment variables to inject into the session (key-value map). | |
| git | No | Optional Git identity/settings for the session. | |
| sandboxId | Yes | Target sandbox ID where the session will be created. | |
| sessionId | No | Optional session identifier. If omitted, a UUID will be generated. | |
| permission | No | Session permission. Use 'read' for non-mutating access, 'write' to allow edits. |