Add stdio MCP server for RollCalc
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
"""Thin MCP-facing adapters over the shared RollCalc domain services."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from roll_calculation import calculate_roll, get_article
|
||||
from transport_calculation import analyze_transport
|
||||
|
||||
|
||||
def get_article_result(
|
||||
article_number: str | None = None,
|
||||
article_name_hint: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Delegate article resolution to the shared article repository."""
|
||||
return get_article(article_number, article_name_hint)
|
||||
|
||||
|
||||
def calculate_roll_diameter_result(
|
||||
*,
|
||||
article_number: str | None = None,
|
||||
article_name_hint: str | None = None,
|
||||
roll_length_m: float | None = None,
|
||||
width_m: float | None = None,
|
||||
thickness_mm: float | None = None,
|
||||
thickness_stddev_mm: float | None = None,
|
||||
area_weight_g_m2: float | None = None,
|
||||
core_diameter_mm: float | None = None,
|
||||
core_type: str | None = None,
|
||||
category: str | None = None,
|
||||
production_site: str | None = None,
|
||||
include_roll_weight: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
"""Map MCP arguments to the existing CalculationRequest input shape."""
|
||||
return calculate_roll({
|
||||
"article_number": article_number,
|
||||
"article_name_hint": article_name_hint,
|
||||
"roll_length_m": roll_length_m,
|
||||
"width_m": width_m,
|
||||
"thickness_mm": thickness_mm,
|
||||
"thickness_stddev_mm": thickness_stddev_mm,
|
||||
"area_weight_g_m2": area_weight_g_m2,
|
||||
"core_diameter_mm": core_diameter_mm,
|
||||
"core_type": core_type,
|
||||
"category": category,
|
||||
"production_site": production_site,
|
||||
"include_roll_weight": include_roll_weight,
|
||||
})
|
||||
|
||||
|
||||
def analyze_transport_capacity_result(
|
||||
*,
|
||||
transport_preset: str | None = None,
|
||||
length_m: float | None = None,
|
||||
width_m: float | None = None,
|
||||
height_m: float | None = None,
|
||||
max_weight_kg: float | None = None,
|
||||
margin_side_m: float | None = None,
|
||||
margin_ceiling_m: float | None = None,
|
||||
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,
|
||||
) -> dict[str, Any]:
|
||||
"""Map MCP arguments to the shared transport-analysis input shape."""
|
||||
return analyze_transport({
|
||||
"transport_preset": transport_preset,
|
||||
"length_m": length_m,
|
||||
"width_m": width_m,
|
||||
"height_m": height_m,
|
||||
"max_weight_kg": max_weight_kg,
|
||||
"margin_side_m": margin_side_m,
|
||||
"margin_ceiling_m": margin_ceiling_m,
|
||||
"roll_diameter_mm": roll_diameter_mm,
|
||||
"core_diameter_mm": core_diameter_mm,
|
||||
"roll_width_m": roll_width_m,
|
||||
"roll_weight_kg": roll_weight_kg,
|
||||
"product_length_m": product_length_m,
|
||||
})
|
||||
Reference in New Issue
Block a user