ModelContextProtocol.Core
Advanced tools
Sorry, the diff of this file is not supported yet
@@ -5,3 +5,3 @@ <?xml version="1.0" encoding="utf-8"?> | ||
| <id>ModelContextProtocol.Core</id> | ||
| <version>0.9.0-preview.2</version> | ||
| <version>1.0.0-rc.1</version> | ||
| <authors>ModelContextProtocol</authors> | ||
@@ -16,3 +16,3 @@ <license type="expression">Apache-2.0</license> | ||
| <tags>ModelContextProtocol mcp ai llm</tags> | ||
| <repository type="git" url="https://github.com/modelcontextprotocol/csharp-sdk" commit="1a6c0ddac976d7b35a91bd7f63ca93cf7483e9fc" /> | ||
| <repository type="git" url="https://github.com/modelcontextprotocol/csharp-sdk" commit="2ec082b42d6191dbf4d10d51e37713fa26516bdb" /> | ||
| <dependencies> | ||
@@ -19,0 +19,0 @@ <group targetFramework="net8.0"> |
+7
-11
@@ -56,3 +56,3 @@ # MCP C# SDK Core | ||
| // echo always returns one and only one text content object | ||
| Console.WriteLine(result.Content.First(c => c.Type == "text").Text); | ||
| Console.WriteLine(result.Content.OfType<TextContentBlock>().First().Text); | ||
| ``` | ||
@@ -72,3 +72,3 @@ | ||
| "your prompt here", | ||
| new() { Tools = [.. tools] }, | ||
| new() { Tools = [.. tools] }); | ||
| ``` | ||
@@ -84,9 +84,5 @@ | ||
| // Create server options | ||
| var serverOptions = new McpServerOptions(); | ||
| // Add tools directly | ||
| serverOptions.Capabilities.Tools = new() | ||
| // Create server options with tools | ||
| var serverOptions = new McpServerOptions | ||
| { | ||
| ListChanged = true, | ||
| ToolCollection = [ | ||
@@ -102,7 +98,7 @@ McpServerTool.Create((string message) => $"hello {message}", new() | ||
| // Create and run server with stdio transport | ||
| var server = new McpServer(serverOptions); | ||
| using var stdioTransport = new StdioServerTransport(); | ||
| await server.RunAsync(stdioTransport, CancellationToken.None); | ||
| await using var stdioTransport = new StdioServerTransport("EchoServer"); | ||
| await using var server = McpServer.Create(stdioTransport, serverOptions); | ||
| await server.RunAsync(CancellationToken.None); | ||
| ``` | ||
| For more advanced scenarios with dependency injection, hosting, and automatic tool discovery, see the `ModelContextProtocol` package. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display