pub const NAME: &str = "lua_repl";
pub const DESCRIPTION: &str = r#"Execute Lua code in a long-lived sandboxed REPL environment.
**Capabilities:**
- Expression evaluation with return values
- print() output capture (appears in tool response)
- Persistent state between executions (variables, functions, tables)
- Safe operations: string, table, math, utf8, os.time, os.date
**Restrictions:**
- No file I/O or network access
- No OS command execution
- No code loading (require, load, loadfile)
- No dangerous metatable operations
**Environment:**
- Sandboxed Lua 5.4
- Documentation available via global `docs` variable
**Input:**
- source_code: Lua code to execute
**Output:**
- result: Expression evaluation result (array of strings) or error message
- output: Lines from print() calls (array of strings)
**Example Usage:**
```lua
-- Calculate and print
x = 10
y = 20
print("Sum:", x + y)
return x + y
-- Result: ["30"]
-- Output: ["Sum:\t10\t20\n"]
```
"#;
pub const PARAM_SOURCE_CODE: &str = "source_code";
pub const PARAM_SOURCE_CODE_DESC: &str =
"Lua source code to execute in the sandboxed REPL environment";
#[cfg(feature = "json_schema")]
pub fn json_schema() -> serde_json::Value {
serde_json::json!({
"type": "object",
"properties": {
PARAM_SOURCE_CODE: {
"type": "string",
"description": PARAM_SOURCE_CODE_DESC
}
},
"required": [PARAM_SOURCE_CODE]
})
}