Add a simple module documentation to help LLMs with the pattern

LLMs have issue infering the actual usage pattern from the code
itself. We add a simple module documentation to help with that.
This commit is contained in:
David Soria Parra
2024-11-25 13:43:50 +00:00
parent 54952ca46a
commit 33f0e590c8
4 changed files with 161 additions and 3 deletions

View File

@@ -1,3 +1,23 @@
"""
Stdio Server Transport Module
This module provides functionality for creating an stdio-based transport layer
that can be used to communicate with an MCP client through standard input/output
streams.
Example usage:
```
async def run_server():
async with stdio_server() as (read_stream, write_stream):
# read_stream contains incoming JSONRPCMessages from stdin
# write_stream allows sending JSONRPCMessages to stdout
server = await create_my_server()
await server.run(read_stream, write_stream, init_options)
anyio.run(run_server)
```
"""
import sys
from contextlib import asynccontextmanager