Harden MCP tool composition

This commit is contained in:
2026-09-24 21:00:48 +02:00
parent bbaaaf31c5
commit 78b00fedf8
7 changed files with 206 additions and 27 deletions
+9 -10
View File
@@ -9,6 +9,7 @@ from rollcalc_mcp_tools import (
calculate_roll_diameter_result,
get_article_result,
)
from transport_calculation import TransportPresetKey
def create_server() -> Any:
@@ -36,11 +37,10 @@ def create_server() -> Any:
core_type: str | None = None,
width_m: float | None = None,
area_weight_g_m2: float | None = None,
include_roll_weight: bool = False,
category: str | None = None,
production_site: str | None = None,
) -> dict[str, Any]:
"""Calculate roll diameter. roll_length_m is the material length on one roll in m; core_diameter_mm, thickness_mm, and thickness_stddev_mm are mm; width_m is m; and area_weight_g_m2 is g/m². Resolve an article or provide applicable manual material inputs. Set include_roll_weight only to request the existing optional roll_weight_kg result."""
"""Calculate roll diameter and weight for one roll. roll_length_m is the material length on one roll in m; core_diameter_mm, thickness_mm, and thickness_stddev_mm are mm; width_m is m; and area_weight_g_m2 is g/m². Resolve an article or provide applicable manual material inputs. This MCP tool always returns roll_weight_kg when the required width_m and area_weight_g_m2 inputs are available. On success, transport_roll_inputs contains the browser-equivalent transport values; pass that bundle's fields unchanged to analyze_transport_capacity."""
return calculate_roll_diameter_result(
article_number=article_number,
article_name_hint=article_name_hint,
@@ -53,17 +53,16 @@ def create_server() -> Any:
core_type=core_type,
category=category,
production_site=production_site,
include_roll_weight=include_roll_weight,
)
@server.tool()
def analyze_transport_capacity(
roll_diameter_mm: float | None = None,
core_diameter_mm: float | None = None,
roll_width_m: float | None = None,
roll_weight_kg: float | None = None,
product_length_m: float | None = None,
transport_preset: str | None = None,
roll_diameter_mm: float,
core_diameter_mm: float,
roll_width_m: float,
roll_weight_kg: float,
product_length_m: float,
transport_preset: TransportPresetKey | None = None,
length_m: float | None = None,
width_m: float | None = None,
height_m: float | None = None,
@@ -71,7 +70,7 @@ def create_server() -> Any:
margin_side_m: float | None = None,
margin_ceiling_m: float | None = None,
) -> dict[str, Any]:
"""Analyze transport capacity. roll_diameter_mm and core_diameter_mm are mm; roll_width_m and product_length_m are m; roll_weight_kg and max_weight_kg are kg. product_length_m is the material length represented by one roll and is used for reported m², not placement geometry. Use a shared transport_preset or supply all custom transport dimensions in m and max_weight_kg. roll_weight_kg is consumed exactly as supplied."""
"""Analyze transport capacity for calculated rolls. For a chained request, first call get_article and calculate_roll_diameter, then pass every field from its transport_roll_inputs bundle unchanged: roll_diameter_mm, core_diameter_mm, roll_width_m, roll_weight_kg, and product_length_m. Do not choose among minimum, average, or maximum diameter; the bundle contains the browser-equivalent nominal transport diameter. product_length_m is used for reported m², not placement geometry. transport_preset must be one of the listed canonical identifiers: lkw_sattelzug means LKW Sattelzug / semi-trailer and lkw_tandem means LKW Tandem. Alternatively, supply all custom transport dimensions in m and max_weight_kg. This stateless tool does not recalculate a roll; roll_weight_kg is consumed exactly as supplied."""
return analyze_transport_capacity_result(
transport_preset=transport_preset,
length_m=length_m,