rhaicp

Crates.iorhaicp
lib.rsrhaicp
version1.0.0
created_at2026-01-06 11:10:10.626586+00
updated_at2026-01-06 11:10:10.626586+00
descriptionAn ACP agent that executes Rhai scripts with MCP tool access
homepage
repositoryhttps://github.com/nikomatsakis/rhaicp
max_upload_size
id2025661
size118,339
Niko Matsakis (nikomatsakis)

documentation

README

rhaicp

An ACP agent that executes Rhai scripts with MCP tool access.

Overview

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) and mcp::call_tool(server, tool, args) for MCP server access

Usage

# Run as an ACP agent over stdio
cargo run -- acp

Rhai API

say(text)

Streams text back to the client:

say("Hello, ");
say("World!");

mcp::list_tools(server)

Lists available tools from an MCP server:

let tools = mcp::list_tools("my-server");
for tool in tools {
    say(tool + "\n");
}

mcp::call_tool(server, tool, args)

Calls a tool on an MCP server:

let result = mcp::call_tool("my-server", "echo", #{ message: "hello" });
say(result.content);

Script Extraction

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.

Running Tests

cargo test
Commit count: 0

cargo fmt