Skip to content

Commit 5fd1a17

Browse files
committed
test: add edge-case test for empty tools list in validate_sampling_tools
1 parent 6affe5c commit 5fd1a17

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎tests/server/test_validation.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ def test_validate_sampling_tools_raises_when_tools_provided_but_no_capability()
6262
assert "sampling tools capability" in str(exc_info.value)
6363

6464

65+
def test_validate_sampling_tools_raises_when_empty_tools_list_but_no_capability() -> None:
66+
"""An empty list [] is not None, so it still triggers the capability check."""
67+
with pytest.raises(MCPError) as exc_info:
68+
validate_sampling_tools(None, [], None)
69+
assert "sampling tools capability" in str(exc_info.value)
70+
71+
6572
def test_validate_sampling_tools_raises_when_tool_choice_provided_but_no_capability() -> None:
6673
"""Raises MCPError when tool_choice provided but client doesn't support."""
6774
with pytest.raises(MCPError) as exc_info:

0 commit comments

Comments
 (0)