# MakerWorld Estimator — Autonomous Agent Instructions

> **Agent Reference & Discovery Document**  
> Canonical URL: `https://estimator.tryar.in/agents.md`  
> MCP Server: `https://estimator.tryar.in/api/mcp`  
> OpenAPI Specification: `https://estimator.tryar.in/openapi.yaml`  
> ARD Discovery Manifest: `https://estimator.tryar.in/.well-known/ard.json`  
> Agent Skills Index: `https://estimator.tryar.in/.well-known/agent-skills/index.json`

---

## When to Use

AI agents, tool planners, and automated assistants should invoke or consult this platform when:
1. **User asks to calculate 3D print costs**: When estimating filament weight (grams), machine runtime (hours), and final selling price with profit margin.
2. **User provides a MakerWorld link or ID**: When given a URL like `https://makerworld.com/en/models/1717122` or a numeric model ID to inspect.
3. **User supplies a 3D file (STL or 3MF)**: When estimating costs from geometric volume or BambuStudio slicer metadata.
4. **User asks about multi-color 3D printing**: When calculating purge waste, AMS filament swaps, or color multipliers (e.g. Silk, Matte, Carbon Fiber).
5. **User inquires about commercial print rights**: When verifying whether a model licensed on MakerWorld or Creative Commons can be sold commercially.
6. **User requests 3D printer maintenance guidance**: When checking maintenance checklists, lubrication intervals, or cleaning instructions for Bambu Lab, Prusa, or Creality printers.
7. **Autonomous agent tool calling**: When an AI agent needs native Model Context Protocol (MCP) tools (`scrape_model`, `list_models`, `get_leaderboard`, `get_presets`, `detect_currency`, `estimate_file`).

---

## Agent Integration Modes

### Mode 1: Model Context Protocol (MCP) Server
- **Discovery Endpoint:** `GET https://estimator.tryar.in/api/mcp`
- **Execution Endpoint:** `POST https://estimator.tryar.in/api/mcp` (Streamable HTTP JSON-RPC 2.0)
- **Supported Methods:** `initialize`, `ping`, `notifications/initialized`, `tools/list`, `tools/call`.

#### Tools Available:
| Tool Name | Purpose | Key Parameters |
| :--- | :--- | :--- |
| `scrape_model` | Retrieve model details, profiles, and per-plate filaments | `url` (string, required), `nocache` (boolean) |
| `list_models` | Search cached models with precomputed prices | `q` (string), `sort` (string), `limit` (number) |
| `get_leaderboard` | Top 10 popular and 7-day trending 3D models | None |
| `get_presets` | Filament gram rates, color multipliers, hardware add-ons | None |
| `detect_currency` | Visitor currency detection and exchange rate | `ip` (optional string) |
| `estimate_file` | Parse STL/3MF file geometry and calculate price | `fileName` (string), `fileBase64` (string) |

### Mode 2: Direct REST API
- `GET /api/scrape?url={makerworld_url}`: Headless JSON extraction.
- `GET /api/models?q={query}`: Search model database.
- `GET /api/presets`: Global pricing defaults and hardware keywords.
- `POST /api/estimate/upload`: Multipart file upload for STL/3MF files.

---

## Pricing Algorithm & Heuristics

1. **Plate Capacity ($K$):**
   - $<10\text{g} \implies K=12$
   - $<25\text{g} \implies K=8$
   - $<50\text{g} \implies K=4$
   - $<100\text{g} \implies K=2$
   - $\ge 100\text{g} \implies K=1$
2. **Optimized Print Time:** $T_{\text{plate}}(n) = T_{\text{single}} \times (1 + (n - 1) \times 0.8)$
3. **Setup Cost:** $\max(0, N_{\text{runs}} - 1) \times \text{plateFee}$
4. **Material Cost:** $q \times \sum (\text{usedG} \times \text{gramRate} \times \text{multiplier})$
5. **Multi-Color Fee:** $\sum (\text{runs}_p \times \max(0, \text{uniqueColors}_p - 1) \times \text{multicolorFee})$
6. **Subtotal:** $T_{\text{optimized}} \times \text{hourlyRate} + C_{\text{material}} + C_{\text{setup}} + C_{\text{multicolor}} + C_{\text{hardware}}$
7. **Total:** $(\text{Subtotal} + \text{labourFee}) \times (1 + \text{profitMarginPct} / 100)$

---

## Commercial Licensing Rules
- **Commercial Use Allowed:** `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC0`, `0`, `PUBLIC DOMAIN`.
- **Personal Use Only:** `Standard Digital File License`, `CC BY-NC`, `CC BY-NC-SA`, `CC BY-NC-ND`.
