Skip to main content

Crate eggsact

Crate eggsact 

Source
Expand description

eggsact - Deterministic MCP and In-Process Utility Tools for Coding Agents

A high-performance Rust crate providing 86 deterministic tools across 23 categories for AI coding agents: math evaluation, text processing, JSON analysis, regex validation, path operations, Unicode safety, shell command preflight, config inspection, and more. Includes a full MCP (Model Context Protocol) server and an in-process agent API.

§Quick Start

use eggsact::{run, evaluate};

// Natural language math — returns (result, type)
let (result, _typ) = run("thirty plus five").unwrap();
assert_eq!(result, "35");

// Direct math evaluation
let (result, _typ) = evaluate("2 ** 10").unwrap();
assert_eq!(result, "1024");

§In-Process Agent API

Call tools directly without starting an MCP server:

use eggsact::agent::{ToolRegistry, Profile};

let registry = ToolRegistry::default();
let response = registry.call_json("text_equal", serde_json::json!({
    "a": "hello",
    "b": "hello",
})).unwrap();
assert!(response.ok);

§Typed Preflight

Use typed wrappers for common workflows:

use eggsact::preflight::{ConfigPreflight, ConfigPreflightInput, ConfigFormat};

let input = ConfigPreflightInput {
    text: r#"{"key": "value"}"#.to_string(),
    format: ConfigFormat::Json,
    schema: None,
    strict: false,
};
let output = ConfigPreflight::run(&input).unwrap();
assert!(output.valid);
assert!(!output.machine_code.is_empty());

Wrappers return Result<Output, PreflightError>. Missing mandatory fields produce ContractViolation errors instead of silently defaulting.

§MCP Server

Run as an MCP server via stdio:

eggsact --mcp

The server accepts JSON-RPC 2.0 requests and provides MCP tools for math, text processing, structured data, paths, Unicode safety, and more.

Re-exports§

pub use calc::evaluate;
pub use calc::evaluate_with_context;
pub use calc::run;
pub use calc::run_with_context;
pub use calc::split_at_operators;
pub use calc::EvalContext;

Modules§

agent
In-process agent API for calling eggsact tools directly.
calc
Calculator module for natural language and mathematical expression evaluation.
mcp
preflight
Typed preflight wrappers for common codegg workflows.
services
Typed deterministic service layer for composite tools.
text
tools