feat(mcp): natural-language measurements for tool inputs via @pascal-app/lingo

Measurement/angle parameters on the scene tools now accept a bare number OR a
natural-language string ("6 in", "180cm", "45°", "1.57rad"), canonicalized to
the unit the handler already expects (meters for length, radians/degrees for
angles) with min/max bounds and model-readable errors. Makes LLM tool calls
safer — "6 in" no longer has to be pre-converted to 0.1524, and a bad value is
rejected with a message the model can self-correct from.

A shared `measurement(kind, unit)` zod field wraps lingo's parseQuantity as a
`number | string` union+transform; numbers pass through unchanged (backward
compatible), so no handler changes were needed. Covers create_wall, cut_opening,
place_item, create_level, create_story_shell, create_roof,
create_stair_between_levels, create_room, add_door, add_window, photo_to_scene.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Aymeric Rabot
2026-07-08 12:51:08 +02:00
co-authored by Claude Opus 4.8
parent a5963560b1
commit f66dcd438b
11 changed files with 264 additions and 35 deletions
+1
View File
@@ -59,6 +59,7 @@
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.29.0",
"@pascal-app/lingo": "^0.1.0",
"zod": "^4.3.5"
},
"devDependencies": {