Use FileUrl on the resources/list call in the simple-resource example (#907)
This commit is contained in:
parent
29c69e6a47
commit
f7265f7b91
1 changed files with 2 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ import anyio
|
|||
import click
|
||||
import mcp.types as types
|
||||
from mcp.server.lowlevel import Server
|
||||
from pydantic import AnyUrl
|
||||
from pydantic import AnyUrl, FileUrl
|
||||
|
||||
SAMPLE_RESOURCES = {
|
||||
"greeting": "Hello! This is a sample text resource.",
|
||||
|
|
@ -26,7 +26,7 @@ def main(port: int, transport: str) -> int:
|
|||
async def list_resources() -> list[types.Resource]:
|
||||
return [
|
||||
types.Resource(
|
||||
uri=AnyUrl(f"file:///{name}.txt"),
|
||||
uri=FileUrl(f"file:///{name}.txt"),
|
||||
name=name,
|
||||
description=f"A sample text resource named {name}",
|
||||
mimeType="text/plain",
|
||||
|
|
|
|||
Loading…
Reference in a new issue