Skip to content

Commit bc7df53

Browse files
committed
handle validation in templates
1 parent 20b4d28 commit bc7df53

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mcp/server/fastmcp/resources/templates.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def from_function(
9999
query_str = query_param_match.group(1)
100100
query_params = set(query_str[1:].split(",")) # Remove the leading '?' and split
101101

102-
required_params = {p for p in required_params if p != context_kwarg}
102+
if context_kwarg:
103+
required_params = required_params.remove(context_kwarg)
103104

104105
# Validate path parameters match required function parameters
105106
if path_params != required_params:

0 commit comments

Comments
 (0)