Bug
search_skills() fails with a Pydantic validation error when using --embedding-provider openai:
1 validation error for SkillSummary
score
Input should be greater than or equal to 0
[type=greater_than_equal, input_value=-0.594804584980011, input_type=float]
Root Cause
In search_service.py, _normalize_score() computes return -float(row["_distance"]). LanceDB cosine distance can exceed 1.0 for certain OpenAI embedding models (e.g. text-embedding-3-large), making the negated score negative.
types.py defines score: float = Field(ge=0.0) which rejects these negative values.
Reproduction
uvx skillport-mcp --embedding-provider openai --openai-embedding-model text-embedding-3-large
# Then call search_skills("any text query") via MCP
With 123+ skills indexed, almost every text query triggers the error. Only search_skills("*") (list-all code path) works because it skips vector search.
Suggested Fix
One-line change in search.py and list.py:
# Before (search.py line 33):
score = float(row.get("_score", 0.0))
# After:
score = max(0.0, float(row.get("_score", 0.0)))
Same pattern in list.py.
Environment
- skillport-mcp v1.1.0
- Python 3.14.3
- LanceDB (via uv)
- Embedding model: OpenAI text-embedding-3-large
Bug
search_skills()fails with a Pydantic validation error when using--embedding-provider openai:Root Cause
In
search_service.py,_normalize_score()computesreturn -float(row["_distance"]). LanceDB cosine distance can exceed 1.0 for certain OpenAI embedding models (e.g.text-embedding-3-large), making the negated score negative.types.pydefinesscore: float = Field(ge=0.0)which rejects these negative values.Reproduction
uvx skillport-mcp --embedding-provider openai --openai-embedding-model text-embedding-3-large # Then call search_skills("any text query") via MCPWith 123+ skills indexed, almost every text query triggers the error. Only
search_skills("*")(list-all code path) works because it skips vector search.Suggested Fix
One-line change in
search.pyandlist.py:Same pattern in
list.py.Environment