Fix the docs and make the more readable (#281)
This commit is contained in:
parent
f4c87f5e2f
commit
f2fd2046f3
1 changed files with 6 additions and 6 deletions
12
README.md
12
README.md
|
|
@ -31,7 +31,7 @@ To get started writing a client, the `McpClientFactory.CreateAsync` method is us
|
||||||
to a server. Once you have an `IMcpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
|
to a server. Once you have an `IMcpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
var clientTransport = new StdioClientTransport(new()
|
var clientTransport = new StdioClientTransport(new StdioClientTransportOptions
|
||||||
{
|
{
|
||||||
Name = "Everything",
|
Name = "Everything",
|
||||||
Command = "npx",
|
Command = "npx",
|
||||||
|
|
@ -163,10 +163,10 @@ using System.Text.Json;
|
||||||
|
|
||||||
McpServerOptions options = new()
|
McpServerOptions options = new()
|
||||||
{
|
{
|
||||||
ServerInfo = new() { Name = "MyServer", Version = "1.0.0" },
|
ServerInfo = new Implementation() { Name = "MyServer", Version = "1.0.0" },
|
||||||
Capabilities = new()
|
Capabilities = new ServerCapabilities()
|
||||||
{
|
{
|
||||||
Tools = new()
|
Tools = new ToolsCapability()
|
||||||
{
|
{
|
||||||
ListToolsHandler = (request, cancellationToken) =>
|
ListToolsHandler = (request, cancellationToken) =>
|
||||||
Task.FromResult(new ListToolsResult()
|
Task.FromResult(new ListToolsResult()
|
||||||
|
|
@ -199,7 +199,7 @@ McpServerOptions options = new()
|
||||||
{
|
{
|
||||||
if (request.Params.Arguments?.TryGetValue("message", out var message) is not true)
|
if (request.Params.Arguments?.TryGetValue("message", out var message) is not true)
|
||||||
{
|
{
|
||||||
throw new McpServerException("Missing required argument 'message'");
|
throw new McpException("Missing required argument 'message'");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult(new CallToolResponse()
|
return Task.FromResult(new CallToolResponse()
|
||||||
|
|
@ -208,7 +208,7 @@ McpServerOptions options = new()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new McpServerException($"Unknown tool: '{request.Params?.Name}'");
|
throw new McpException($"Unknown tool: '{request.Params?.Name}'");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue