loading…
Search for a command to run...
loading…
Provides specialized tools for electromagnetics and magnetic circuit analysis, including field calculations, material property lookups, and unit conversions. It
Provides specialized tools for electromagnetics and magnetic circuit analysis, including field calculations, material property lookups, and unit conversions. It enables AI agents to perform precise physics computations and reason through complex engineering problems using real-world equations.
A sample project demonstrating a skill-agnostic AI agent that dynamically loads domain expertise from markdown skill definitions, with an example magnetics/electromagnetics SME skill.
This project showcases a generic agent framework that can work with any domain expertise by loading tool definitions and system prompts from skill.md files. The magnetics example demonstrates how to build an expert-level AI agent for electromagnetics and magnetic circuit design using real equations and precise numerical computations.
Key features:
┌──────────────────────────────────────┐
│ CLI (cli.py) │
│ - Skill selection & discovery │
│ - Interactive chat interface │
└────────────────┬─────────────────────┘
│
┌────────────────▼─────────────────────┐
│ SkillAgent (Anthropic SDK) │
│ - Agentic loop │
│ - Tool orchestration │
│ - skill.md parsing & loading │
└────────────────┬─────────────────────┘
│
┌────────▼─────────┐
│ Skills/ │
│ <skill-name>/ │
│ - skill.md │
│ - tool configs │
└────────┬─────────┘
│
┌───────────┴───────────┬──────────────┐
│ │ │
┌────▼─────┐ ┌─────────┐ ┌─┴──────────┐ ┌─┴──────┐
│ Fields │ │Circuits │ │ Materials │ │Convert │
│ (fields) │ │(circuits)│ │ (materials)│ │(units) │
└──────────┘ └─────────┘ └────────────┘ └────────┘
maxwell_bot/
├── agent/
│ ├── agent.py # SkillAgent: generic, skill-agnostic framework
│ └── __init__.py
├── mcp_server/
│ ├── tools/
│ │ ├── fields.py # B/H field calculations (solenoid, wire, flux, energy)
│ │ ├── circuits.py # Reluctance, MMF calculations
│ │ ├── materials.py # Material property lookup (6 materials)
│ │ ├── converters.py # Unit conversions (T↔Gauss, Wb↔Maxwell, etc.)
│ │ └── __init__.py
│ └── __init__.py
├── skills/
│ └── maxwell_magnetics/
│ └── skill.md # Skill definition: tool reference, use cases, boundaries
├── tests/
│ ├── test_fields.py # Field calculation tests
│ ├── test_circuits.py # Circuit calculation tests
│ ├── test_materials.py # Material lookup tests
│ ├── test_converters.py # Conversion tests
│ └── __init__.py
├── cli.py # Interactive CLI entry point
├── requirements.txt # Python dependencies
├── .gitignore
└── README.md # This file
pip package managergit clone https://github.com/jkearney126/maxwell_bot.git
cd maxwell_bot
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
export ANTHROPIC_API_KEY="sk-ant-..." # On Windows: set ANTHROPIC_API_KEY=sk-ant-...
Or, for persistent setup, add to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export ANTHROPIC_API_KEY="your-key-here"
python cli.py
This launches an interactive chat where you can:
quit or exit to exitThe agent auto-discovers skills from the skills/ directory and loads tool definitions and expertise from each skill's skill.md file.
Each skill lives in skills/<skill-name>/ with a skill.md file that defines:
The agent is completely skill-agnostic:
skills/<name>/skill.md with proper formatThis separation of "what" (skill definition) from "how" (agent implementation) makes the framework flexible and reusable.
Each skill can include a knowledge base of domain documents to augment agent responses with relevant context.
skills/<skill>/knowledge/ are indexed on first loadCreate markdown files in skills/<skill-name>/knowledge/:
skills/
└── maxwell_magnetics/
├── skill.md
└── knowledge/
├── real_world_applications.md
├── design_mistakes_troubleshooting.md
├── materials_and_components.md
└── standards_and_safety.md
Document Format:
## Section Title headers for automatic chunkingThe included magnetics skill has 4 knowledge documents covering:
Result: 33 semantic chunks indexed, ~80% relevance for domain-specific queries
skills/<skill>/.chroma_db/✓ Agent initialized with skill: maxwell_magnetics
✓ Loaded 8 tools
======================================================================
SKILL AGENT - MAXWELL_MAGNETICS
======================================================================
Example prompts you can use:
1. What is the magnetic field at the center of a solenoid with 500 turns, 20cm long, carrying 2A?
2. I'm designing a magnetic circuit with a 10cm iron core (μr=5000), 2cm² cross-section. What is the reluctance?
3. How much energy is stored in a 50mT field occupying 0.5 liters?
4. Compare the permeability of silicon steel vs ferrite.
5. Convert 1.2 Tesla to Gauss.
======================================================================
User: What is the magnetic field at the center of a solenoid with 500 turns, 20cm long, carrying 2A?
======================================================================
🧠 Thinking...
Agent: I'll calculate the magnetic field at the center of the solenoid using the formula B = μ₀ · n · I...
🔧 Calling tool: solenoid_field
Input: {
"turns": 500,
"length_m": 0.2,
"current_A": 2.0
}
Result: {
"B_tesla": 0.006283185307179586,
"equation": "B = μ₀ · n · I"
}
Agent: The magnetic field at the center of the solenoid is approximately **6.28 mT** (millitesla)...
pytest tests/ -v
pytest tests/test_fields.py -v # Field calculations
pytest tests/test_circuits.py -v # Circuit calculations
pytest tests/test_materials.py -v # Material lookups
pytest tests/test_converters.py -v # Unit conversions
pip install pytest-cov
pytest tests/ --cov=mcp_server --cov=agent
solenoid_fieldCompute magnetic field at the center of a solenoid.
Equation: B = μ₀ · n · I
Inputs:
turns (int): Number of turnslength_m (float): Length in meterscurrent_A (float): Current in amperesExample:
Input: 500 turns, 0.2m long, 2A
Output: B = 6.28 mT
biot_savart_wireCompute magnetic field around an infinite straight current-carrying wire.
Equation: B = μ₀I / (2πr)
Inputs:
current_A (float): Current in amperesdistance_m (float): Distance from wire in metersExample:
Input: 10A at 0.1m
Output: B = 20 μT
magnetic_fluxCompute magnetic flux through a surface.
Equation: Φ = B · A · cos(θ)
Inputs:
B_tesla (float): Flux density in Teslaarea_m2 (float): Area in square metersangle_deg (float, default 0): Angle in degreesExample:
Input: 0.1T, 0.01m², 0° angle
Output: Φ = 0.001 Wb (1 mWb)
energy_storedCompute energy stored in a magnetic field.
Equation: W = (B² / (2μ₀)) · Volume
Inputs:
B_tesla (float): Flux density in Teslavolume_m3 (float): Volume in cubic metersExample:
Input: 50mT in 0.5L (0.0005m³)
Output: W ≈ 0.99 Joules
reluctanceCompute reluctance of a magnetic circuit path.
Equation: R = l / (μ₀ · μᵣ · A)
Inputs:
length_m (float): Path length in metersarea_m2 (float): Cross-sectional area in square metersrelative_permeability (float): Material's μᵣExample:
Input: Iron core (μᵣ=5000), 0.1m long, 2cm² area
Output: R ≈ 79,600 H⁻¹
mmf_requiredCompute magnetomotive force (MMF) for a magnetic path.
Equation: MMF = H · l
Inputs:
H_field (float): Field strength in A/mpath_length_m (float): Path length in metersExample:
Input: H = 1000 A/m, l = 0.1m
Output: MMF = 100 AT (Ampere-turns)
material_lookupReturn properties of a magnetic material.
Inputs:
material (string): Material name (case-insensitive)Available Materials:
air — Vacuum/air (μᵣ = 1)iron — Pure iron, soft magnetic (μᵣ = 5000, Bsat = 2.15 T)silicon_steel — Transformer core (μᵣ = 4000, Bsat = 2.0 T)ferrite — Hard magnetic (μᵣ = 2000, Bsat = 0.4 T)neodymium — NdFeB permanent magnet (μᵣ = 1.05, Bsat = 1.4 T)mu_metal — Shielding material (μᵣ = 80000, Bsat = 0.8 T)Example:
Input: "neodymium"
Output: {
"relative_permeability": 1.05,
"saturation_flux_density_T": 1.4,
"coercivity_A_per_m": 955000.0
}
unit_convertConvert between magnetic units.
Supported Conversions:
Inputs:
value (float): Value to convertfrom_unit (string): Source unitto_unit (string): Target unitExample:
Input: 1.2 T → Gauss
Output: 12000 Gauss
User: "What is the magnetic field at the center of a solenoid with 500 turns, 20cm long, carrying 2A?"
Agent:
solenoid_field toolUser: "I'm designing a magnetic circuit with a 10cm iron core (μr=5000), 2cm² cross-section. What is the reluctance?"
Agent:
material_lookup("iron") to verify μᵣreluctance with core parametersUser: "How much energy is stored in a 50mT field occupying 0.5 liters?"
Agent:
energy_stored toolThis project includes comprehensive tests covering:
Run all tests:
pytest tests/ -v --tb=short
Ensure your API key is set:
export ANTHROPIC_API_KEY="sk-ant-..."
python cli.py
Ensure your skill is properly structured:
skills/
└── <skill-name>/
└── skill.md
The agent auto-discovers skills by looking for skill.md files in subdirectories of skills/.
| Package | Purpose |
|---|---|
anthropic>=0.25.0 |
Anthropic Python SDK (Claude API) |
chromadb>=0.4.0 |
Vector database for RAG (Chroma) |
sentence-transformers>=3.0.0 |
Semantic embeddings for retrieval |
pytest>=7.4.0 |
Test framework |
pytest-asyncio>=0.21.0 |
Async test support |
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"magnetics-sme-mcp-server": {
"command": "npx",
"args": []
}
}
}Web content fetching and conversion for efficient LLM usage.
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also