From 08d35a04cbd5d5bb3d7481e5a14901d7972600f4 Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Wed, 27 Nov 2024 23:04:06 +0000 Subject: [PATCH] Fix docs on resource template usage --- docs/first-server/python.mdx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/first-server/python.mdx b/docs/first-server/python.mdx index 12559a1b..3c78a867 100644 --- a/docs/first-server/python.mdx +++ b/docs/first-server/python.mdx @@ -638,18 +638,15 @@ uvicorn.run(app, host="0.0.0.0", port=8000) ```python - @self.list_resources() - async def list_resources(self) -> ListResourcesResult: - return ListResourcesResult( - resources=[...], - resourceTemplates=[ - ResourceTemplate( - uriTemplate="weather://{city}/current", - name="Current weather for any city", - mimeType="application/json" - ) - ] - ) + @app.list_resource_templates() + async def list_resource_templates() -> list[ResourceTemplate]: + return [ + ResourceTemplate( + uriTemplate="weather://{city}/current", + name="Current weather for any city", + mimeType="application/json" + ) + ] ```