Server instructions added to IMcpClient (#17)

This commit is contained in:
Peder Holdgaard Pedersen 2025-01-24 20:36:05 +01:00 • committed by GitHub
commit 86f1edfe38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 58 additions and 6 deletions

View file

@ -25,6 +25,13 @@ public interface IMcpClient : IAsyncDisposable
/// </summary>
Implementation? ServerInfo { get; }
/// <summary>
/// Instructions describing how to use the server and its features.
/// This can be used by clients to improve the LLM's understanding of available tools, resources, etc.
/// It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.
/// </summary>
string? ServerInstructions { get; }
/// <summary>
/// Gets or sets the handler for server sampling requests.
/// </summary>

View file

@ -37,6 +37,9 @@ internal class McpClient : IMcpClient
/// <inheritdoc/>
public Implementation? ServerInfo { get; private set; }
/// <inheritdoc/>
public string? ServerInstructions { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="McpClient"/> class.
/// </summary>
@ -154,6 +157,7 @@ internal class McpClient : IMcpClient
_logger.ServerCapabilitiesReceived(_serverConfig.Id, _serverConfig.Name, JsonSerializer.Serialize(initializeResponse.Capabilities), JsonSerializer.Serialize(initializeResponse.ServerInfo));
ServerCapabilities = initializeResponse.Capabilities;
ServerInfo = initializeResponse.ServerInfo;
ServerInstructions = initializeResponse.Instructions;
// Validate protocol version
if (initializeResponse.ProtocolVersion != _options.ProtocolVersion)

View file

@ -9,7 +9,7 @@
<PropertyGroup>
<!-- license and package properties -->
<PackageId>mcpdotnet</PackageId>
<Version>0.8.0.1</Version>
<Version>0.9.0.1</Version>
<Authors>PederHP</Authors>
<Description>.NET client library for the Model Context Protocol (MCP)</Description>
<PackageProjectUrl>https://github.com/PederHP/mcpdotnet</PackageProjectUrl>