Skip to content

Commit ea2f89e

Browse files
committed
fix: Fix resource test
1 parent 7e95a99 commit ea2f89e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/issues/test_141_resource_templates.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pydantic import AnyUrl
33

44
from mcp.server.fastmcp import FastMCP
5+
from mcp.shared.exceptions import McpError
56
from mcp.shared.memory import (
67
create_connected_server_and_client_session as client_session,
78
)
@@ -57,10 +58,10 @@ def get_user_profile_missing(user_id: str) -> str:
5758
assert result_list[0].mime_type == "text/plain"
5859

5960
# Verify invalid parameters raise error
60-
with pytest.raises(ValueError, match="Unknown resource"):
61+
with pytest.raises(McpError, match="Unknown resource"):
6162
await mcp.read_resource("resource://users/123/posts") # Missing post_id
6263

63-
with pytest.raises(ValueError, match="Unknown resource"):
64+
with pytest.raises(McpError, match="Unknown resource"):
6465
await mcp.read_resource("resource://users/123/posts/456/extra") # Extra path component
6566

6667

0 commit comments

Comments
 (0)