Skip to content

Commit f7265f7

Browse files
authored
Use FileUrl on the resources/list call in the simple-resource example (#907)
1 parent 29c69e6 commit f7265f7

File tree

1 file changed

+2
-2
lines changed
  • examples/servers/simple-resource/mcp_simple_resource

1 file changed

+2
-2
lines changed

examples/servers/simple-resource/mcp_simple_resource/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import click
33
import mcp.types as types
44
from mcp.server.lowlevel import Server
5-
from pydantic import AnyUrl
5+
from pydantic import AnyUrl, FileUrl
66

77
SAMPLE_RESOURCES = {
88
"greeting": "Hello! This is a sample text resource.",
@@ -26,7 +26,7 @@ def main(port: int, transport: str) -> int:
2626
async def list_resources() -> list[types.Resource]:
2727
return [
2828
types.Resource(
29-
uri=AnyUrl(f"file:///{name}.txt"),
29+
uri=FileUrl(f"file:///{name}.txt"),
3030
name=name,
3131
description=f"A sample text resource named {name}",
3232
mimeType="text/plain",

0 commit comments

Comments
 (0)