Adding a base class for request params that exposes the progressToken (#99)

* Adding a base class for request params that exposes the progressToken

This aligns more with the type structure see in the other SDK's (eg: https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/types.py#L41) while also ensuring they are exposing the JSONRPCRequest (https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json#L771-L806) data.

Storing progressToken as an object as it could be an int or string (per https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json#L1268-L1274).

Fixes #67

* Using usings

* Apply suggestions from code review

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
This commit is contained in:
Aaron Powell 2025-03-26 14:40:48 +11:00 • committed by GitHub
commit 6fa1443a6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,15 @@
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol.Types;
/// <summary>
/// Metadata related to the request.
/// </summary>
public class RequestParamsMetadata
{
/// <summary>
/// If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
/// </summary>
[JsonPropertyName("progressToken")]
public object ProgressToken { get; set; } = default!;
}