Skip to content

MCP needs to support units extensions #162

@withtwoemms

Description

@withtwoemms

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
    WHEN define_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
    WHEN convert(value, from_unit, to_unit) is called
    THEN the conversion must succeed using session-defined units.

  • GIVEN a session with custom definitions
    WHEN reset_session() is called
    THEN all custom units and edges must be cleared.

  • GIVEN a reset session
    WHEN a previously-defined custom unit is used in convert()
    THEN an unknown_unit error must be returned.

Inline Parameters (Recovery Path)

  • GIVEN no prior session state
    WHEN convert(..., 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 inline custom_units and custom_edges
    THEN the conversion must succeed (recovery pattern).

Caching (Optimization)

  • GIVEN identical custom_units and custom_edges on multiple calls
    WHEN the inline graph is compiled
    THEN the cached graph must be reused (no redundant compilation).

Metadata

Metadata

Assignees

Labels

enhancementSome non-critical improvement of a feature; ergonomics

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions