An ACP agent that executes Rhai scripts with MCP tool access.
Rhaicp provides a scriptable agent that:
- Accepts prompts containing Rhai programs (or
<userRequest>...</userRequest>blocks) - Exposes
say(text)to stream responses back to the client - Exposes
mcp::list_tools(server)andmcp::call_tool(server, tool, args)for MCP server access
# Run as an ACP agent over stdio
cargo run -- acpStreams text back to the client:
say("Hello, ");
say("World!");
Lists available tools from an MCP server:
let tools = mcp::list_tools("my-server");
for tool in tools {
say(tool + "\n");
}
Calls a tool on an MCP server:
let result = mcp::call_tool("my-server", "echo", #{ message: "hello" });
say(result.content);
Writes content to the file at path. It then sends a ToolCallUpdate on the result.
Example:
write_file("notes.txt", "Hello from Rhai!");
If your prompt contains <userRequest>...</userRequest> tags, only the content inside those tags is executed as Rhai. Otherwise, the entire prompt is treated as a Rhai script.
cargo test