Use strong-typing of params in most remaining McpClientExtensions methods (#224)

This commit is contained in:
Stephen Toub 2025-04-07 11:30:42 -04:00 • committed by GitHub
commit 03dc90aa33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 74 additions and 73 deletions

View file

@ -1,4 +1,5 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol.Types;
@ -11,12 +12,12 @@ public class CallToolRequestParams : RequestParams
/// <summary>
/// Tool name.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("name")]
[JsonPropertyName("name")]
public required string Name { get; init; }
/// <summary>
/// Optional arguments to pass to the tool.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("arguments")]
public Dictionary<string, JsonElement>? Arguments { get; init; }
[JsonPropertyName("arguments")]
public IReadOnlyDictionary<string, JsonElement>? Arguments { get; init; }
}

View file

@ -1,4 +1,7 @@
namespace ModelContextProtocol.Protocol.Types;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol.Types;
/// <summary>
/// Used by the client to get a prompt provided by the server.
@ -9,12 +12,12 @@ public class GetPromptRequestParams : RequestParams
/// <summary>
/// he name of the prompt or prompt template.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("name")]
[JsonPropertyName("name")]
public required string Name { get; init; }
/// <summary>
/// Arguments to use for templating the prompt.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("arguments")]
public Dictionary<string, object>? Arguments { get; init; }
[JsonPropertyName("arguments")]
public IReadOnlyDictionary<string, JsonElement>? Arguments { get; init; }
}