---
name: "xpay-code-runner-execute-code-with-variables"
description: "Execute JavaScript or Python code with dynamic input variables that can be defined and passed as key-value pairs"
version: "1.0.0"
price: "$0.01/call"
provider: "Code Runner"
---

# Execute Code With Variables

Execute JavaScript or Python code with dynamic input variables that can be defined and passed as key-value pairs

**Provider:** Code Runner
**Price:** $0.01/call
**Pricing model:** Flat rate per call

## When to Use

Use this tool when you need to execute javascript or python code with dynamic input variables that can be defined and passed as key-value pairs. This is part of the Code Runner provider on xpay✦.

## MCP Connection

Connect to xpay✦ to access this tool (and 3+ others):

```json
{
  "mcpServers": {
    "xpay": {
      "url": "https://mcp.xpay.sh/mcp?key=YOUR_API_KEY"
    }
  }
}
```

For Claude Code:
```bash
claude mcp add --transport http xpay "https://mcp.xpay.sh/mcp?key=YOUR_API_KEY"
```

## How to Execute

Use the xpay✦ meta-tools to run this tool:

1. **`xpay_details`** — Get full input schema: `xpay_details("code-runner/execute_code_with_variables")`
2. **`xpay_run`** — Execute: `xpay_run("code-runner/execute_code_with_variables", { ...inputs })`

## Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `input` | string | No | Additional input data for the program (stdin) |
| `variables` | string | No | Dynamic input variables as key-value pairs. Can be a JSON object or a JSON string (e.g., {"name": "John", "age": 25, "items": [1,2,3]} or "{\"name\": \"John\", \"age\": 25}") |
| `code` | string | Yes | Code to execute |
| `enableNetworking` | boolean | No | Enable network access for this execution |
| `language` | string | Yes | Programming language to execute |
| `memoryLimit` | number | No | Memory limit in MB (max 512) |
| `timeout` | number | No | Execution timeout in milliseconds (max 60000) |

## Pricing

- **Cost:** $0.01/call
- **Balance check:** Use `xpay_balance` to check remaining credits
- Get your API key at [xpay.tools](https://xpay.tools/account/settings/api-keys/) — $5 free credits included

## Related Skills

- [Code Runner (all tools)](https://xpay.tools/skills/code-runner/SKILL.md) — 4 tools
- [Execute Code](https://xpay.tools/skills/code-runner/execute-code/SKILL.md) — $0.01/call
- [Get Capabilities](https://xpay.tools/skills/code-runner/get-capabilities/SKILL.md) — $0.01/call
- [Validate Code](https://xpay.tools/skills/code-runner/validate-code/SKILL.md) — $0.01/call

## Links

- Tool page: https://xpay.tools/code-runner/execute-code-with-variables/
- Provider: https://xpay.tools/code-runner/
- All tools: https://xpay.tools/explore
