Skip to content

Rhai API Reference ​

Auto-generated from the ChaosNexus Anvil engine schema. The engine is the single source of truth: every function below is emitted by the compiled runtime.

Engine version: 0.1.0 - generated 2026-06-29T04:24:21.654735119+00:00.

global module ​

Global ChaosNexus Anvil engine functions available to every Rhai plugin without an explicit import.

assert ​

Signature ​

rust
assert(_: bool, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0bool-
arg1string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

base64_decode ​

Signature ​

rust
base64_decode(_: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

base64_encode ​

Signature ​

rust
base64_encode(_: string) -> string

Parameters ​

NameTypeDescription
arg0string-

Returns ​

string

call_native ​

Signature ​

rust
call_native(_: string, _: array) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1array-

Returns ​

core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

create_event ​

Signature ​

rust
create_event(_: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

create_timer ​

Signature ​

rust
create_timer(_: string, _: i64, _: bool, _: string, _: types::dynamic::Dynamic)

Parameters ​

NameTypeDescription
arg0string-
arg1i64-
arg2bool-
arg3string-
arg4types::dynamic::Dynamic-

Returns ​

()

db_connect ​

Signature ​

rust
db_connect(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

db_execute ​

Signature ​

rust
db_execute(_: string, _: string, _: array) -> core::result::Result<i64,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2array-

Returns ​

core::result::Result<i64,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

db_query ​

Signature ​

rust
db_query(_: string, _: string, _: array) -> core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2array-

Returns ​

core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

fire_event ​

Signature ​

rust
fire_event(_: string, _: types::dynamic::Dynamic) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1types::dynamic::Dynamic-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

from_json ​

Signature ​

rust
from_json(_: string) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

fs_append ​

Signature ​

rust
fs_append(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

fs_delete ​

Signature ​

rust
fs_delete(_: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

fs_exists ​

Signature ​

rust
fs_exists(_: string, _: string) -> core::result::Result<bool,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<bool,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

fs_list_dir ​

Signature ​

rust
fs_list_dir(_: string, _: string) -> core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

fs_read ​

Signature ​

rust
fs_read(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

fs_write ​

Signature ​

rust
fs_write(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

get_cvar ​

Signature ​

rust
get_cvar(_: string) -> string

Parameters ​

NameTypeDescription
arg0string-

Returns ​

string

get_env ​

Signature ​

rust
get_env(_: string) -> string

Parameters ​

NameTypeDescription
arg0string-

Returns ​

string

get_global ​

Signature ​

rust
get_global(_: string) -> types::dynamic::Dynamic

Parameters ​

NameTypeDescription
arg0string-

Returns ​

types::dynamic::Dynamic

hmac_sha256 ​

Signature ​

rust
hmac_sha256(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

hook_event ​

Signature ​

rust
hook_event(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

http_get ​

Signature ​

rust
http_get(_: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

http_post ​

Signature ​

rust
http_post(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

json_extract ​

Signature ​

rust
json_extract(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

kv_dump ​

Signature ​

rust
kv_dump() -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

kv_get ​

Signature ​

rust
kv_get(_: string) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

kv_set ​

Signature ​

rust
kv_set(_: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

load_config ​

Signature ​

rust
load_config(_: string, _: string) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

load_config_string ​

Signature ​

rust
load_config_string(_: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

log_debug ​

Signature ​

rust
log_debug(_: string, _: string)

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

()

log_error ​

Signature ​

rust
log_error(_: string, _: string)

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

()

log_info ​

Signature ​

rust
log_info(_: string, _: string)

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

()

mcp_call_tool ​

Signature ​

rust
mcp_call_tool(_: string, _: string, _: map) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2map-

Returns ​

core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

mcp_connect ​

Signature ​

rust
mcp_connect(_: string, _: string, _: string, _: array) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-
arg3array-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

mcp_disconnect ​

Signature ​

rust
mcp_disconnect(_: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

mcp_list_tools ​

Signature ​

rust
mcp_list_tools(_: string) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

mcp_log ​

Signature ​

rust
mcp_log(_: string, _: string, _: string)

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-

Returns ​

()

mcp_read_resource ​

Signature ​

rust
mcp_read_resource(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

md5 ​

Signature ​

rust
md5(_: string) -> string

Parameters ​

NameTypeDescription
arg0string-

Returns ​

string

ntp_request ​

Signature ​

rust
ntp_request(_: string, _: i64) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1i64-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

regex_match ​

Signature ​

rust
regex_match(_: string, _: string) -> core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

regex_replace ​

Signature ​

rust
regex_replace(_: string, _: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

register_cvar ​

Signature ​

rust
register_cvar(_: string, _: string, _: string, _: string)

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-
arg3string-

Returns ​

()

register_mcp_prompt ​

Registers a new prompt template on this MCP server.

Signature ​

rust
register_mcp_prompt(plugin_name: &str, prompt_name: &str, desc: &str, args_json: &str) -> Result<(),Box<rhai::EvalAltResult>>

Parameters ​

NameTypeDescription
plugin_name&strThe internal name of the plugin registering the prompt.
prompt_name&strThe unique name of the prompt template.
desc&strA description of what the prompt provides.
args_json&strA JSON string representing an array of PromptArgument objects (or an empty array/string).

Returns ​

Result<(),Box<rhai::EvalAltResult>>

register_mcp_resource ​

Registers a new resource on this MCP server.

Signature ​

rust
register_mcp_resource(plugin_name: &str, resource_name: &str, uri: &str, desc: &str) -> Result<(),Box<rhai::EvalAltResult>>

Parameters ​

NameTypeDescription
plugin_name&strThe internal name of the plugin registering the resource.
resource_name&strThe human-readable name of the resource.
uri&strThe unique URI identifying the resource (e.g., file:///path).
desc&strA description of the resource's contents.

Returns ​

Result<(),Box<rhai::EvalAltResult>>

register_mcp_tool ​

Registers a new tool on this MCP server.

Signature ​

rust
register_mcp_tool(plugin_name: &str, tool_name: &str, desc: &str, schema_json: &str) -> Result<(),Box<rhai::EvalAltResult>>

Parameters ​

NameTypeDescription
plugin_name&strThe internal name of the plugin registering the tool.
tool_name&strThe unique name of the tool exposed to clients.
desc&strA human-readable description of what the tool does.
schema_json&strA JSON string representing the JSON Schema for the tool's input arguments.

Returns ​

Result<(),Box<rhai::EvalAltResult>>

register_native ​

Signature ​

rust
register_native(_: string, _: string, _: string)

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-

Returns ​

()

route_webhook ​

Signature ​

rust
route_webhook(_: string, _: i64, _: string, _: string)

Parameters ​

NameTypeDescription
arg0string-
arg1i64-
arg2string-
arg3string-

Returns ​

()

run_command ​

Signature ​

rust
run_command(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

set_global ​

Signature ​

rust
set_global(_: string, _: types::dynamic::Dynamic)

Parameters ​

NameTypeDescription
arg0string-
arg1types::dynamic::Dynamic-

Returns ​

()

sha256 ​

Signature ​

rust
sha256(_: string) -> string

Parameters ​

NameTypeDescription
arg0string-

Returns ​

string

sleep ​

Signature ​

rust
sleep(_: i64)

Parameters ​

NameTypeDescription
arg0i64-

Returns ​

()

start_webhook_server ​

Signature ​

rust
start_webhook_server(_: string, _: i64) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1i64-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

sys_install_plugin ​

Signature ​

rust
sys_install_plugin(_: string, _: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-
arg3string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

sys_os ​

Signature ​

rust
sys_os() -> string

Returns ​

string

system_time ​

Signature ​

rust
system_time(_: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

tcp_request ​

Signature ​

rust
tcp_request(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

to_json ​

Signature ​

rust
to_json(_: types::dynamic::Dynamic) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0types::dynamic::Dynamic-

Returns ​

core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>

translate ​

Signature ​

rust
translate(_: string, _: string, _: string, _: array) -> string

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-
arg3array-

Returns ​

string

ws_close ​

Signature ​

rust
ws_close(_: string)

Parameters ​

NameTypeDescription
arg0string-

Returns ​

()

ws_connect ​

Signature ​

rust
ws_connect(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>

Parameters ​

NameTypeDescription
arg0string-
arg1string-
arg2string-

Returns ​

core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>