A collection of lightning-fast WebAssembly functions designed for real-time computation in LLM applications. Perfect for MCP (Model Context Protocol) servers and any system requiring sub-millisecond mathematical precision alongside AI reasoning.
Large Language Models excel at understanding and generating text, but they often struggle with precise mathematical computations. Core Tools solves this by providing:
- Real-Time Performance: WASM functions with sub-millisecond response times for LLM interactions
- MCP-Ready: Designed to plug directly into Model Context Protocol servers
- 84 Precision Functions: From GPS calculations to 3D math, all optimized for speed
- Minimal Cold Starts: WebAssembly design minimizes startup latency for responsive AI
- Validated Accuracy: Well-tested implementations with comprehensive error handling
- ⚡ Sub-millisecond Response: WASM execution ensures real-time LLM augmentation
- 🎯 Precision Math: Accurate calculations that LLMs can't reliably perform
- 🔌 MCP Compatible: Ready to integrate with Model Context Protocol servers
- 🚀 Zero Setup: Single binary deployment with all 84 functions included
- 🛡️ Error Handling: Comprehensive validation and error messages for reliable operation
core-tools/
├── tools/ # 84 WASM computation functions
│ ├── geospatial/ # GPS & mapping (11 functions)
│ ├── math3d/ # 3D operations (20 functions)
│ ├── statistics/ # Data analysis (12 functions)
│ ├── basic_math/ # Core math (25 functions)
│ └── utilities/ # Helpers (16 functions)
├── docs/ # API documentation
├── tests/ # Test suite
├── spin.toml # WASM runtime config
└── Makefile # Build automation
- Language: Rust (compiled to WebAssembly for maximum speed)
- Runtime: Spin Framework (optimized WASM runtime)
- Architecture: Individual WASM functions with HTTP endpoints
- Integration: JSON APIs designed for LLM/MCP server integration
- Performance: Sub-millisecond execution for real-time AI applications
# Build all tools
make build
# Build only changed tools (faster for development)
make build-changed
# Build in debug mode
make build-debug
# Clean build artifacts
make clean
# Show all available commands
make help# Build all tools in parallel
./build_all.sh build
# Build only tools that changed since main branch
./build_all.sh changed
# Build with more parallel jobs (default: 4)
./build_all.sh --jobs 8 build
# Show all available options
./build_all.sh helpInstant GPS calculations, spatial analysis, and geofencing - all with sub-millisecond response for real-time LLM interactions with location data.
Vector operations, geometric intersections, and transformations that execute faster than an LLM can generate the next token.
Real-time statistics, correlations, and regression analysis to augment LLM data interpretation with precise calculations.
Core arithmetic through advanced math - providing the computational precision LLMs lack, instantly.
Fast encoding, validation, and data processing functions to handle formats and transformations in real-time.
// Calculate optimal delivery routes using Core Tools APIs
async function optimizeDeliveryRoute(warehouse, deliveries) {
const distances = [];
// Calculate distance from warehouse to each delivery
for (const delivery of deliveries) {
const response = await fetch('http://localhost:3000/distance', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
lat1: warehouse.lat, lon1: warehouse.lon,
lat2: delivery.lat, lon2: delivery.lon
})
});
const result = await response.json();
distances.push({
delivery: delivery.id,
distance_km: result.distance_km
});
}
// Sort by distance for simple nearest-neighbor routing
return distances.sort((a, b) => a.distance_km - b.distance_km);
}import requests
import numpy as np
def analyze_beam_connection(beam1_vector, beam2_vector):
"""Analyze the connection between two structural beams"""
# Calculate angle between beams
angle_response = requests.post(
'http://localhost:3000/vector-angle',
json={
'vector1': {'x': beam1_vector[0], 'y': beam1_vector[1], 'z': beam1_vector[2]},
'vector2': {'x': beam2_vector[0], 'y': beam2_vector[1], 'z': beam2_vector[2]}
}
)
angle_data = angle_response.json()
# Check if angle is within structural limits (e.g., 45-135 degrees)
if 45 <= angle_data['angle_degrees'] <= 135:
return {
'status': 'valid',
'angle': angle_data['angle_degrees'],
'message': 'Connection angle within acceptable range'
}
else:
return {
'status': 'warning',
'angle': angle_data['angle_degrees'],
'message': 'Connection angle may require additional support'
}// Automated quality control using statistical analysis
async fn check_production_quality(measurements: Vec<f64>) -> QualityReport {
let client = reqwest::Client::new();
// Get comprehensive statistics
let stats_response = client.post("http://localhost:3000/descriptive-statistics")
.json(&serde_json::json!({ "data": measurements }))
.send()
.await?
.json::<DescriptiveStats>()
.await?;
// Test for normal distribution
let normality_response = client.post("http://localhost:3000/test-normality")
.json(&serde_json::json!({ "data": measurements, "alpha": 0.05 }))
.send()
.await?
.json::<NormalityTest>()
.await?;
QualityReport {
mean: stats_response.mean,
std_dev: stats_response.std_dev,
within_spec: stats_response.std_dev < 0.2, // Example specification
normally_distributed: normality_response.is_normal,
action_required: stats_response.std_dev > 0.2 || !normality_response.is_normal
}
}- One Function, One Purpose: Each tool is a focused WASM function for a specific calculation
- Real-Time First: Optimized for sub-millisecond response in LLM conversations
- MCP-Ready Design: JSON interfaces compatible with Model Context Protocol
- Composable Functions: Chain simple functions to build complex computations
- Low Latency: WASM execution minimizes overhead for fast response times
# Set up everything needed for development
make dev-setup
# Check project statistics
make stats
# Generate documentation
make docs# Build only changed tools (fast iteration)
make build-changed
# Run tests on the built tools
make test
# Build and package for release
make package- Create directory for your function:
tools/[category]/[function-name]/ - Set up Cargo.toml with FTL SDK dependencies
- Implement the WASM function in
src/lib.rsusing#[tool]attribute - Register HTTP endpoint in
spin.toml - Test with
./curl.shfor sub-millisecond response - Build and verify:
make build-changed
The project includes a 3-tier validation system:
- Build Validation: All 84 tools compile to WebAssembly without errors
- Unit Test Validation: Comprehensive unit test coverage for all tools
- HTTP Endpoint Validation: End-to-end testing via HTTP requests using
curl.sh - Integration Testing: Complex operations like
vector_analysiscomposition patterns
- Geospatial Tools Guide - Complete reference for GPS and spatial calculations
- 3D Mathematics Guide - Vector operations, transformations, and geometry
- Statistical Analysis Guide - Statistics, correlation, and regression methods
Plug these functions directly into your Model Context Protocol server for instant mathematical capabilities in your AI applications.
- Conversational AI: Add real-time calculations to chatbots with minimal latency
- AI Assistants: Augment reasoning with precise computational results
- Voice Interfaces: Sub-millisecond math for responsive voice applications
- Live Data Analysis: Statistical calculations that keep pace with streaming data
- Interactive 3D: Instant geometric computations for AR/VR with AI
- Location Services: GPS calculations fast enough for real-time navigation
We welcome contributions! Core Tools is designed to be extended with new computational capabilities.
# 1. Fork and clone the repository
git clone https://github.com/YOUR-USERNAME/core-tools.git
cd core-tools
# 2. Set up development environment
make dev-setup
# 3. Create a new branch
git checkout -b feature/your-new-tool
# 4. Build and test
make build-changed # Builds only modified tools
make test # Run the test suite-
Choose the right category for your tool (or propose a new one)
-
Create the tool structure:
mkdir -p tools/[category]/[your-tool-name] cd tools/[category]/[your-tool-name] cargo init --lib -
Implement your tool using the FTL SDK pattern:
use ftl_sdk::tool; #[tool] async fn your_tool_name(input: YourInput) -> YourOutput { // Your implementation here }
-
Add to spin.toml to register the HTTP endpoint
-
Test thoroughly with comprehensive test cases
-
Submit a PR with a clear description of what your tool does
- Error Handling: All tools must handle errors gracefully
- Validation: Validate all inputs before processing
- Documentation: Include clear documentation and examples
- Testing: Provide comprehensive test coverage
- Performance: Keep response times under 100ms when possible
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Built with Spin - The WebAssembly runtime for instant function execution
- Powered by Rust - Compiled to WASM for maximum performance
- Uses FTL SDK - For rapid function development
- Designed for MCP - Ready for Model Context Protocol integration