backend updates on recommendation system
This commit is contained in:
@@ -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"})
|
||||
|
||||
Reference in New Issue
Block a user