Skip to content

MCP Error Suggestions #151

@withtwoemms

Description

@withtwoemms

As an AI agent using ucon-MCP tools,
I want error responses that localize the problem, name the fix, and distinguish high-confidence corrections from exploratory hints,
So that I can self-correct in a single retry without human intervention.


Acceptance Criteria

Response model

  • ConversionError model with fields: error, error_type, parameter, got, expected, likely_fix, hints
  • error_type is one of: "unknown_unit", "dimension_mismatch", "no_conversion_path"

Unknown unit errors

  • convert() catches UnknownUnitError for both from_unit and to_unit
  • check_dimensions() catches UnknownUnitError for both inputs
  • list_units() catches invalid dimension filter
  • parameter field identifies which input was bad
  • Single high-confidence fuzzy match (≥ 0.7) populates likely_fix
  • Multiple or lower-confidence matches populate hints only
  • Unrecognizable inputs produce no spurious matches — only generic hints

Dimension mismatch errors

  • convert() catches DimensionMismatch
  • Error message uses readable dimension names (never Vector(...))
  • got and expected fields carry dimension names
  • Compatible units listed from graph edges (not theoretical dimension matches)

No conversion path errors

  • convert() catches ConversionNotFound
  • Pseudo-dimension isolation is explained (not just stated)
  • Hints include alternative computation approach (e.g., "compute angle/2π explicitly")
  • Missing-edge case suggests intermediate conversion path when dimensions match

Structural

  • Suggestion logic lives in ucon/mcp/suggestions.py, not in server.py
  • No error response error field contains the string "Vector("
  • All error responses are valid ConversionError instances (no raw exceptions)

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