Improve documentation comments for transport types (#98)
* Add example usage to HTTPClientTransport documentation comments * Add documentation comments to NetworkTransport * Improve documentation comments for StdioTransport
This commit is contained in:
parent
bdaa2585c5
commit
daef492821
1 changed files with 159 additions and 7 deletions
|
|
@ -26,6 +26,27 @@ import Logging
|
|||
/// - Streaming HTTP with SSE (`streaming=true`): Enables server-to-client push messages
|
||||
///
|
||||
/// - Important: Server-Sent Events (SSE) functionality is not supported on Linux platforms.
|
||||
///
|
||||
/// ## Example Usage
|
||||
///
|
||||
/// ```swift
|
||||
/// import MCP
|
||||
///
|
||||
/// // Create a streaming HTTP transport
|
||||
/// let transport = HTTPClientTransport(
|
||||
/// endpoint: URL(string: "http://localhost:8080")!,
|
||||
/// )
|
||||
///
|
||||
/// // Initialize the client with streaming transport
|
||||
/// let client = Client(name: "MyApp", version: "1.0.0")
|
||||
/// try await client.connect(transport: transport)
|
||||
///
|
||||
/// // Initialize the connection
|
||||
/// let result = try await client.initialize()
|
||||
///
|
||||
/// // The transport will automatically handle SSE events
|
||||
/// // and deliver them through the client's notification handlers
|
||||
/// ```
|
||||
public actor HTTPClientTransport: Transport {
|
||||
/// The server endpoint URL to connect to
|
||||
public let endpoint: URL
|
||||
|
|
|
|||
Loading…
Reference in a new issue