fix(mcp): restore >0 validation and reject ambiguous numbers in measurement()

Adversarial-review follow-ups to the lingo measurement() field:
- Add a `positive` option (strict > 0) and use it for the non-zero dimension
  params. Swapping z.number().positive() → measurement(..,{min:0}) had started
  admitting 0 (the core node schemas have no positivity backstop), so a zero-size
  wall/opening/roof could be created. Inclusive-0 fields (overhang, sill height,
  knee-wall height, opening offset, roof pitch) keep min:0.
- Escalate AMBIGUOUS_NUMBER to error so "1,234" fails instead of silently reading
  as 1234 — a 1000x hazard for European decimals. Matches lingo's own /ai fields.
- roofLevelElevation reverted to z.number() (it's a level ordinal, not meters);
  radians fields now advertise radian-appropriate examples.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Aymeric Rabot
2026-07-08 13:09:59 +02:00
co-authored by Claude Opus 4.8
parent f66dcd438b
commit 3273aac551
7 changed files with 108 additions and 48 deletions
@@ -25,11 +25,11 @@ export const photoToSceneInput = {
name: z.string().default('Scene from photo'),
save: z.boolean().default(true),
defaultWallThickness: measurement('length', 'm', {
min: 0,
positive: true,
description: 'Default wall thickness.',
}).default(0.2),
defaultWallHeight: measurement('length', 'm', {
min: 0,
positive: true,
description: 'Default wall height.',
}).default(2.6),
}