Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2005,8 +2005,13 @@ async def list_all_resources() -> None:
print(f"Total resources: {len(all_resources)}")


if __name__ == "__main__":
def main():
"""Entry point for the pagination client."""
asyncio.run(list_all_resources())


if __name__ == "__main__":
main()
```

_Full example: [examples/snippets/clients/pagination_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/pagination_client.py)_
Expand Down Expand Up @@ -2146,8 +2151,13 @@ async def main():
print(f"Available tools: {[tool.name for tool in tools.tools]}")


if __name__ == "__main__":
def run():
"""Entry point for the streamable basic client."""
asyncio.run(main())


if __name__ == "__main__":
run()
```

_Full example: [examples/snippets/clients/streamable_basic.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/streamable_basic.py)_
Expand Down
7 changes: 6 additions & 1 deletion examples/snippets/clients/pagination_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,10 @@ async def list_all_resources() -> None:
print(f"Total resources: {len(all_resources)}")


if __name__ == "__main__":
def main():
"""Entry point for the pagination client."""
asyncio.run(list_all_resources())


if __name__ == "__main__":
main()
7 changes: 6 additions & 1 deletion examples/snippets/clients/parsing_tool_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@ async def main():
await parse_tool_results()


if __name__ == "__main__":
def run():
"""Entry point for the parsing tool results client."""
asyncio.run(main())


if __name__ == "__main__":
run()
7 changes: 6 additions & 1 deletion examples/snippets/clients/streamable_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ async def main():
print(f"Available tools: {[tool.name for tool in tools.tools]}")


if __name__ == "__main__":
def run():
"""Entry point for the streamable basic client."""
asyncio.run(main())


if __name__ == "__main__":
run()
3 changes: 3 additions & 0 deletions examples/snippets/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ completion-client = "clients.completion_client:main"
direct-execution-server = "servers.direct_execution:main"
display-utilities-client = "clients.display_utilities:main"
oauth-client = "clients.oauth_client:run"
pagination-client = "clients.pagination_client:main"
parsing-tool-results-client = "clients.parsing_tool_results:run"
streamable-basic-client = "clients.streamable_basic:run"