-
Notifications
You must be signed in to change notification settings - Fork 0
Description
As an AI agent using ucon via MCP
I want to define custom units and conversions at runtime
So I can perform conversions for domain-specific units that are not in ucon's core library
Acceptance Criteria
Session Tools
-
GIVEN a call to
define_unit(name, dimension, aliases)
WHEN the dimension is valid
THEN the unit must be registered in the session graph and a confirmation returned. -
GIVEN a call to
define_unit(name, dimension, aliases)
WHEN the dimension is invalid
THEN a structured error with suggestions must be returned. -
GIVEN a unit registered via
define_unit
WHENdefine_conversion(src, dst, factor)is called with that unit
THEN a conversion edge must be added to the session graph. -
GIVEN units and edges registered via session tools
WHENconvert(value, from_unit, to_unit)is called
THEN the conversion must succeed using session-defined units. -
GIVEN a session with custom definitions
WHENreset_session()is called
THEN all custom units and edges must be cleared. -
GIVEN a reset session
WHEN a previously-defined custom unit is used inconvert()
THEN an unknown_unit error must be returned.
Inline Parameters (Recovery Path)
-
GIVEN no prior session state
WHENconvert(..., custom_units=[...], custom_edges=[...])is called
THEN the conversion must succeed using the inline definitions. -
GIVEN inline definitions on
convert()
WHEN the call completes
THEN the session graph must NOT be modified (inline is ephemeral). -
GIVEN inline definitions on
compute()
WHEN the call completes
THEN multi-step calculations must work with inline-defined units. -
GIVEN an unknown_unit error from a prior
convert()call
WHEN the agent retries with inlinecustom_unitsandcustom_edges
THEN the conversion must succeed (recovery pattern).
Caching (Optimization)
- GIVEN identical
custom_unitsandcustom_edgeson multiple calls
WHEN the inline graph is compiled
THEN the cached graph must be reused (no redundant compilation).