Skip to content

Commit 4cdb9a2

Browse files
committed
Illustrate using ResumeSessionAsync
1 parent a72baf9 commit 4cdb9a2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/concepts/transports/transports.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,20 @@ var transport = new HttpClientTransport(new HttpClientTransportOptions
9595

9696
#### Resuming sessions
9797

98-
Streamable HTTP supports session resumption. Save the session ID and reuse it to reconnect:
98+
Streamable HTTP supports session resumption. Save the session ID, server capabilities, and server info from the original session, then use <xref:ModelContextProtocol.Client.McpClient.ResumeSessionAsync*> to reconnect:
9999

100100
```csharp
101101
var transport = new HttpClientTransport(new HttpClientTransportOptions
102102
{
103103
Endpoint = new Uri("https://my-mcp-server.example.com/mcp"),
104104
KnownSessionId = previousSessionId
105105
});
106+
107+
await using var client = await McpClient.ResumeSessionAsync(transport, new ResumeClientSessionOptions
108+
{
109+
ServerCapabilities = previousServerCapabilities,
110+
ServerInfo = previousServerInfo
111+
});
106112
```
107113

108114
#### Streamable HTTP server (ASP.NET Core)

0 commit comments

Comments
 (0)