Expose product length calculation through MCP

This commit is contained in:
2026-09-25 21:21:20 +02:00
parent 580e9caa5e
commit e6a7d4da72
10 changed files with 357 additions and 7 deletions
+15 -4
View File
@@ -118,9 +118,11 @@ Authentication is implemented with `Flask-HTTPAuth`. The current code checks `BE
`mcp_server.py` provides a local stdio-only Model Context Protocol server. It is
a thin adapter over the same domain services used by Flask: article lookup,
direct roll calculation, material-weight calculation, and transport analysis.
direct roll calculation, product-length calculation, material-weight calculation,
and transport analysis.
The available PoC tools are `get_article`, `search_articles`,
`calculate_material_weight`, `calculate_roll_diameter`, and
`calculate_material_weight`, `calculate_product_length`,
`calculate_roll_diameter`, and
`analyze_transport_capacity`.
Install the pinned dependencies, including `mcp==1.26.0`, in the existing
@@ -132,7 +134,7 @@ environment, then start it with:
```
The PoC has no MCP resources, HTTP/SSE transport, remote authentication, or
dedicated product-length or target-length calculation tools, or extrapolation.
dedicated target-length calculation tool or extrapolation support.
Tool calling semantics:
@@ -145,6 +147,11 @@ Tool calling semantics:
- `calculate_material_weight` calculates material-only weight from roll length,
width, and area weight. It requires no core diameter, does not infer one, and
cannot return a roll diameter or a core-inclusive total weight.
- `calculate_product_length` calculates required roll length from a target outer
diameter, core diameter, and material thickness. Its optional thickness
stddev returns minimum/average/maximum length ranges; optional width and area
weight return material-weight ranges. It does not infer missing article or
material inputs.
- `calculate_roll_diameter` uses `roll_length_m` for the material length on one
roll. Diameter and thickness inputs are in mm; `width_m` is in m;
`area_weight_g_m2` is in g/m². It requires a known positive core diameter;
@@ -382,7 +389,11 @@ The direct calculation tab supports multiple modes via mode buttons:
- Product length from core diameter, material thickness, and roll diameter.
- Product length for a target diameter.
The direct roll-diameter mode posts raw decision inputs to `/api/calculations/roll`. The authoritative implementation is `calculate_roll()` in `roll_calculation.py`; the template only renders its result.
The direct roll-diameter mode posts raw decision inputs to `/api/calculations/roll`.
The Product Length mode posts to `/api/calculations/product-length`. The
authoritative implementations are `calculate_roll()` and
`calculate_product_length()` in `roll_calculation.py`; the template only renders
their results.
The four core preset buttons are rendered from the canonical ordered `CORE_PRESETS` tuple in `core_presets.py`. Headless and conversational core resolution uses the same tuple and its finite German/English aliases. Generic steel and PVC family names remain ambiguous because the current UI contains two presets for each family.