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
assert(_: bool, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | bool | - |
arg1 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
base64_decode
Signature
base64_decode(_: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
base64_encode
Signature
base64_encode(_: string) -> stringParameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
string
call_native
Signature
call_native(_: string, _: array) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | array | - |
Returns
core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
create_event
Signature
create_event(_: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
create_timer
Signature
create_timer(_: string, _: i64, _: bool, _: string, _: types::dynamic::Dynamic)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | i64 | - |
arg2 | bool | - |
arg3 | string | - |
arg4 | types::dynamic::Dynamic | - |
Returns
()
db_connect
Signature
db_connect(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
db_execute
Signature
db_execute(_: string, _: string, _: array) -> core::result::Result<i64,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | array | - |
Returns
core::result::Result<i64,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
db_query
Signature
db_query(_: string, _: string, _: array) -> core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | array | - |
Returns
core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
fire_event
Signature
fire_event(_: string, _: types::dynamic::Dynamic) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | types::dynamic::Dynamic | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
from_json
Signature
from_json(_: string) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
fs_append
Signature
fs_append(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
fs_delete
Signature
fs_delete(_: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
fs_exists
Signature
fs_exists(_: string, _: string) -> core::result::Result<bool,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<bool,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
fs_list_dir
Signature
fs_list_dir(_: string, _: string) -> core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
fs_read
Signature
fs_read(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
fs_write
Signature
fs_write(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
get_cvar
Signature
get_cvar(_: string) -> stringParameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
string
get_env
Signature
get_env(_: string) -> stringParameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
string
get_global
Signature
get_global(_: string) -> types::dynamic::DynamicParameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
types::dynamic::Dynamic
hmac_sha256
Signature
hmac_sha256(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
hook_event
Signature
hook_event(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
http_get
Signature
http_get(_: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
http_post
Signature
http_post(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
json_extract
Signature
json_extract(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
kv_dump
Signature
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
kv_get(_: string) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
kv_set
Signature
kv_set(_: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
load_config
Signature
load_config(_: string, _: string) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
load_config_string
Signature
load_config_string(_: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
log_debug
Signature
log_debug(_: string, _: string)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
()
log_error
Signature
log_error(_: string, _: string)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
()
log_info
Signature
log_info(_: string, _: string)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
()
mcp_call_tool
Signature
mcp_call_tool(_: string, _: string, _: map) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | map | - |
Returns
core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
mcp_connect
Signature
mcp_connect(_: string, _: string, _: string, _: array) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
arg3 | array | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
mcp_disconnect
Signature
mcp_disconnect(_: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
mcp_list_tools
Signature
mcp_list_tools(_: string) -> core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<rhai::types::dynamic::Dynamic,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
mcp_log
Signature
mcp_log(_: string, _: string, _: string)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
Returns
()
mcp_read_resource
Signature
mcp_read_resource(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
md5
Signature
md5(_: string) -> stringParameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
string
ntp_request
Signature
ntp_request(_: string, _: i64) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | i64 | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
regex_match
Signature
regex_match(_: string, _: string) -> core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::vec::Vec<rhai::types::dynamic::Dynamic>,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
regex_replace
Signature
regex_replace(_: string, _: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
register_cvar
Signature
register_cvar(_: string, _: string, _: string, _: string)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
arg3 | string | - |
Returns
()
register_mcp_prompt
Registers a new prompt template on this MCP server.
Signature
register_mcp_prompt(plugin_name: &str, prompt_name: &str, desc: &str, args_json: &str) -> Result<(),Box<rhai::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
plugin_name | &str | The internal name of the plugin registering the prompt. |
prompt_name | &str | The unique name of the prompt template. |
desc | &str | A description of what the prompt provides. |
args_json | &str | A 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
register_mcp_resource(plugin_name: &str, resource_name: &str, uri: &str, desc: &str) -> Result<(),Box<rhai::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
plugin_name | &str | The internal name of the plugin registering the resource. |
resource_name | &str | The human-readable name of the resource. |
uri | &str | The unique URI identifying the resource (e.g., file:///path). |
desc | &str | A description of the resource's contents. |
Returns
Result<(),Box<rhai::EvalAltResult>>
register_mcp_tool
Registers a new tool on this MCP server.
Signature
register_mcp_tool(plugin_name: &str, tool_name: &str, desc: &str, schema_json: &str) -> Result<(),Box<rhai::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
plugin_name | &str | The internal name of the plugin registering the tool. |
tool_name | &str | The unique name of the tool exposed to clients. |
desc | &str | A human-readable description of what the tool does. |
schema_json | &str | A JSON string representing the JSON Schema for the tool's input arguments. |
Returns
Result<(),Box<rhai::EvalAltResult>>
register_native
Signature
register_native(_: string, _: string, _: string)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
Returns
()
route_webhook
Signature
route_webhook(_: string, _: i64, _: string, _: string)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | i64 | - |
arg2 | string | - |
arg3 | string | - |
Returns
()
run_command
Signature
run_command(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
set_global
Signature
set_global(_: string, _: types::dynamic::Dynamic)Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | types::dynamic::Dynamic | - |
Returns
()
sha256
Signature
sha256(_: string) -> stringParameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
string
start_webhook_server
Signature
start_webhook_server(_: string, _: i64) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | i64 | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
sys_install_plugin
Signature
sys_install_plugin(_: string, _: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
arg3 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>
system_time
Signature
system_time(_: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
tcp_request
Signature
tcp_request(_: string, _: string) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
to_json
Signature
to_json(_: types::dynamic::Dynamic) -> core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | types::dynamic::Dynamic | - |
Returns
core::result::Result<alloc::string::String,alloc::boxed::Box<rhai::types::error::EvalAltResult>>
translate
Signature
translate(_: string, _: string, _: string, _: array) -> stringParameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
arg3 | array | - |
Returns
string
ws_connect
Signature
ws_connect(_: string, _: string, _: string) -> core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>Parameters
| Name | Type | Description |
|---|---|---|
arg0 | string | - |
arg1 | string | - |
arg2 | string | - |
Returns
core::result::Result<(),alloc::boxed::Box<rhai::types::error::EvalAltResult>>