Skip to content

Commit 89c744e

Browse files
committed
Fix compilation errors in new docs
1 parent 952ba6c commit 89c744e

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

docs/concepts/ping/ping.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ MCP includes a [ping mechanism] that allows either side of a connection to verif
1616
Use the <xref:ModelContextProtocol.Client.McpClient.PingAsync*> method to verify the server is responsive:
1717

1818
```csharp
19-
await client.PingAsync(cancellationToken);
19+
await client.PingAsync(cancellationToken: cancellationToken);
2020
```
2121

2222
### Automatic ping handling

docs/concepts/resources/resources.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ builder.Services.AddMcpServer()
215215
if (ctx.Params?.Uri is { } uri)
216216
{
217217
// Track the subscription (e.g., in a concurrent dictionary)
218-
subscriptions[context.Server.SessionId].TryAdd(uri, 0);
218+
subscriptions[ctx.Server.SessionId].TryAdd(uri, 0);
219219
}
220220
return new EmptyResult();
221221
})

docs/concepts/sampling/sampling.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,8 @@ McpClientOptions options = new()
100100
SamplingHandler = async (request, progress, cancellationToken) =>
101101
{
102102
// Forward to your LLM, apply content filtering, etc.
103-
string prompt = request?.Messages?.LastOrDefault()?.Content switch
104-
{
105-
TextContentBlock text => text.Text,
106-
_ => string.Empty
107-
};
103+
string prompt = request?.Messages?.LastOrDefault()?.Content
104+
.OfType<TextContentBlock>().FirstOrDefault()?.Text ?? string.Empty;
108105

109106
return new CreateMessageResult
110107
{

0 commit comments

Comments
 (0)