{"id":"bb701d75-5577-4b0e-9c95-06fde1be4f4f","slug":"onetool","kind":"mcp","name":"onetool","summary":"Sandboxed Lua runtime for LLM tool use.","owner":"caioaao","repoUrl":"https://github.com/caioaao/onetool","license":"MIT","licenseTier":"permissive","trust":"community","stars":5,"match":null,"fewStars":false,"format":"mcp","createdAt":"2026-02-19T20:47:43.000Z","addedAt":"2026-10-21T16:51:02.575Z","logoUrl":"https://avatars.githubusercontent.com/u/1395990?u=58de4a30ad79ae891eceb1b49fa90e823fb459e7&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["utilities"],"tags":["llm","ai","ai-tools"],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-26T20:26:43.817Z","sample":false,"url":"https://conduits.dev/tools/onetool","language":"Rust","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# onetool\n\n**Sandboxed Lua runtime for LLM tool use.**\n\n[API Documentation](https://docs.rs/onetool)\n\n## The Problem\n\nLLM agents typically need dozens of specialized tools (calculator, date formatter, string manipulator, JSON parser, base64 encoder, hash generator, etc.). Each tool requires a round-trip to the LLM provider, and you pay for every token exchanged. Tools don't compose well, and you're always limited by what you thought to create.\n\n## The Solution\n\n**onetool provides a sandboxed Lua REPL** that LLMs can use as a single tool.\n\nLLMs are already trained on programming languages. By giving them code execution instead of specialized tools, you reduce token costs (one tool call instead of many) while increasing flexibility. State persists between calls for multi-step reasoning. It's safe by design with comprehensive sandboxing.\n\n## Installation\n\n**Basic REPL only** (no LLM framework):\n```toml\n[dependencies]\nonetool = \"0.0.1-alpha.10\"\n```\n\n**With a framework adapter:**\n```toml\n# Pick one (or more):\nonetool = { version = \"0.0.1-alpha.10\", features = [\"genai\"] }\nonetool = { version = \"0.0.1-alpha.10\", features = [\"mistralrs\"] }\nonetool = { version = \"0.0.1-alpha.10\", features = [\"rig\"] }\nonetool = { version = \"0.0.1-alpha.10\", features = [\"aisdk\"] }\nonetool = { version = \"0.0.1-alpha.10\", features = [\"mcp\"] }\n```\n\n**Feature flags:**\n\n| Feature | Description |\n|---------|-------------|\n| `genai` | [genai](https://github.com/jeremychone/rust-genai) adapter |\n| `mistralrs` | [mistral.rs](https://github.com/EricLBuehler/mistral.rs) adapter |\n| `rig` | [rig-core](https://github.com/0xPlaygrounds/rig) `Tool` implementation |\n| `aisdk` | [aisdk](https://github.com/lazy-hq/aisdk) integration |\n| `mcp` | [MCP](https://modelcontextprotocol.io/) server via rmcp |\n| `json_schema` | JSON Schema generation (included by all above) |\n\n**Note:** Currently in alpha - API may change.\n\n## Quick Start\n\n```rust\nuse onetool::Repl;\n\n// Create the sandboxed Lua runtime\nlet repl = Repl::new()?;\n\n// Execute Lua code\nlet response = repl.eval(\"return 2 + 2\")?;\n\n// Access results\nprintln!(\"Result: {}\", response.result.unwrap().join(\"\\n\")); // \"4\"\nprintln!(\"Output: {}\", response.output.join(\"\\n\"));          // (print() output)\n```\n\nThe REPL maintains state between calls, so variables and functions persist:\n\n```rust\nrepl.eval(\"x = 10\")?;\nrepl.eval(\"y = 20\")?;\nlet result = repl.eval(\"return x + y\")?; // \"30\"\n```\n\n## Real Example\n\nHere's an actual interaction from the included example:\n\n```\nUser: \"What's the sum of the 10 first prime numbers?\"\n\nLLM calls lua_repl with:\n{\n  \"source_code\": \"\n    local primes = {}\n    local num = 2\n    while #primes < 10 do\n      local is_prime = true\n      for i = 2, math.sqrt(num) do\n        if num % i == 0 then\n          is_prime = false\n          break\n        end\n      end\n      if is_prime then\n        table.insert(primes, num)\n      end\n      num = num + 1\n    end\n\n    local sum = 0\n    for _, p in ipairs(primes) do\n      sum = sum + p\n    end\n    return sum\n  \"\n}\n\nResponse: {\n  \"result\": \"129\",\n  \"output\": \"\"\n}\n\nLLM: \"The sum of the first 10 prime numbers is 129.\"\n```\n\nThe LLM wrote a complete algorithm, executed it safely, and got the answer - all without needing a specialized \"prime number calculator\" tool.\n\n## Why Lua?\n\nThese were the criteria for choosing the execution language:\n\n- **Interpreted**: We can't depend on a compile-eval loop\n- **Easy to embed**: The runtime needs to live inside the host application\n- **Easy to sandbox**: Giving too much power to an LLM can be dangerous\n- **Simple and expressive**: LLMs need to write small, correct snippets\n- **Strong standard library**: Especially for string manipulation\n- **Mature and well-known**: Editor plugins, documentation, familiarity\n\nLua checks all these boxes. It's widespread enough (neovim config language, game scripting) that LLMs are well-trained on it.\n\n## Running the Examples\n\n```bash\n# Interactive REPL (no API key required)\ncargo run --example lua-repl\n\n# Custom Rust functions in the runtime\ncargo run --example custom-functions\n\n# Interactive notebook demo (requires API key)\ncargo run --features notebook_demo --example notebook-demo # DEEPSEEK_API_KEY\n\n# LLM framework examples (require API keys where noted)\ncargo run --features genai --example genai-basic        # DEEPSEEK_API_KEY\ncargo run --features mistralrs --example mistralrs-basic # local inference, no key\ncargo run --features rig --example rig-basic             # DEEPSEEK_API_KEY\ncargo run --features aisdk --example aisdk-basic         # DEEPSEEK_API_KEY\ncargo run --features mcp --example mcp-basic             # MCP stdio server\n```\n\n## Project Status\n\n**This is still a toy project.** Use with care - everything may break, and I might decide to change everything tomorrow.\n\n- **Version**: 0.0.1-alpha.10\n- **API Stability**: Expect breaking changes\n- **Production Ready**: No\n\nThe core concept is stable (sandboxed Lua REPL for LLMs), but the implementation and API surface are experimental.\n\n## License & Contributing\n\n**License:** MIT - Copyright 2026 Caio Augusto Araujo Oliveira\n\n**Contributing:**\n- Early stage project - feedback welcome!\n- Issues and PRs appreciated\n\n---\n\nBuilt with [mlua](https://github.com/mlua-rs/mlua).\n"}