Skip to content

Commit eab2820

Browse files
committed
documentation corrections
1 parent 768f515 commit eab2820

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/mcp/server/fastmcp/server.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,8 @@ def resource(
550550
has parameters, it will be registered as a template resource.
551551
552552
Function parameters in the path are required,
553-
while parameters with default values
554-
can be optionally provided as query parameters using RFC 6570 form-style query
555-
expansion syntax: {?param1,param2,...}
556-
557-
Examples:
558-
- resource://{category}/{id}{?filter,sort,limit}
559-
- resource://{user_id}/profile{?format,fields}
553+
while parameters with default values need to be provided
554+
in the function definion.
560555
561556
Args:
562557
uri: URI for the resource (e.g. "resource://my-resource" or "resource://{param}")
@@ -579,13 +574,12 @@ def get_data() -> str:
579574
def get_weather(city: str) -> str:
580575
return f"Weather for {city}"
581576
582-
@server.resource("resource://{city}/weather{?units}")
577+
@server.resource("resource://{city}/weather")
583578
def get_weather_with_options(city: str, units: str = "metric") -> str:
584579
# Can be called with resource://paris/weather?units=imperial
585580
return f"Weather for {city} in {units} units"
586581
587-
@server.resource("resource://{category}/{id}
588-
{?filter,sort,limit}")
582+
@server.resource("resource://{category}/{id}")
589583
def get_item(category: str, id: str, filter: str = "all", sort: str = "name"
590584
, limit: int = 10) -> str:
591585
# Can be called with resource://electronics/1234?filter=new&sort=price&limit=20

0 commit comments

Comments
 (0)