Skip to content

Commit

Permalink
Merge pull request #56 from modelcontextprotocol/davidsp/python-sdk-77
Browse files Browse the repository at this point in the history
Fix docs on resource template usage
  • Loading branch information
dsp-ant authored Nov 28, 2024
2 parents 8fe8271 + 08d35a0 commit 9ceeac6
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions docs/first-server/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -638,18 +638,15 @@ uvicorn.run(app, host="0.0.0.0", port=8000)

<Step title="Add resource templates">
```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"
)
]
```
</Step>
</Steps>
Expand Down

0 comments on commit 9ceeac6

Please sign in to comment.