Skip to content

Commit bf3dd5e

Browse files
authored
Fix a couple issues in the client sample readme (#994)
1 parent 4b132dc commit bf3dd5e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ To get started writing a client, the `McpClient.CreateAsync` method is used to i
4141
to a server. Once you have an `McpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
4242

4343
```csharp
44+
using ModelContextProtocol.Client;
45+
using ModelContextProtocol.Protocol;
46+
4447
var clientTransport = new StdioClientTransport(new StdioClientTransportOptions
4548
{
4649
Name = "Everything",
@@ -63,7 +66,7 @@ var result = await client.CallToolAsync(
6366
cancellationToken:CancellationToken.None);
6467

6568
// echo always returns one and only one text content object
66-
Console.WriteLine(result.Content.First(c => c.Type == "text").Text);
69+
Console.WriteLine(result.Content.OfType<TextContentBlock>().First().Text);
6770
```
6871

6972
You can find samples demonstrating how to use ModelContextProtocol with an LLM SDK in the [samples](samples) directory, and also refer to the [tests](tests/ModelContextProtocol.Tests) project for more examples. Additional examples and documentation will be added as in the near future.

0 commit comments

Comments
 (0)