backend updates on recommendation system

This commit is contained in:
sriram
2026-10-07 11:03:42 +05:30
parent 82f5db1250
commit 71dbb2a6e9
6 changed files with 599 additions and 6 deletions

View File

@@ -23,7 +23,8 @@ def test_only_read_only_catalogue_tools_are_exposed():
async with Client(mcp) as c:
return {t.name: set(t.input_schema.get("properties", {})) for t in await c.list_tools()}
tools = anyio.run(go)
assert set(tools) == {"list_categories", "search_products", "get_product", "price_history"}
assert set(tools) == {"list_categories", "search_products", "get_product", "price_history",
"recommend_products"}
assert tools["search_products"] == {"query", "category", "brand", "max_price", "min_price", "limit"}
# Nothing that can start a run, log in, or change data.
assert not any(w in name for name in tools for w in ("admin", "run", "login", "probe", "review"))
@@ -91,3 +92,11 @@ def test_unknown_product_is_a_tool_error(db):
with pytest.raises(ToolError, match="not found"):
_call("get_product", {"product_id": 999999})
def test_recommend_products_rejects_an_unknown_kind():
import pytest
from fastmcp.exceptions import ToolError
with pytest.raises(ToolError, match="better_rated"):
_call("recommend_products", {"product_id": 1, "kind": "cheapest"})