@@ -12,44 +12,45 @@ namespace ModelContextProtocol.Protocol.Messages;
1212[ JsonConverter ( typeof ( Converter ) ) ]
1313public readonly struct ProgressToken : IEquatable < ProgressToken >
1414{
15- /// <summary>The id , either a string or a boxed long or null.</summary>
16- private readonly object ? _id ;
15+ /// <summary>The token , either a string or a boxed long or null.</summary>
16+ private readonly object ? _token ;
1717
1818 /// <summary>Initializes a new instance of the <see cref="ProgressToken"/> with a specified value.</summary>
1919 /// <param name="value">The required ID value.</param>
2020 public ProgressToken ( string value )
2121 {
2222 Throw . IfNull ( value ) ;
23- _id = value ;
23+ _token = value ;
2424 }
2525
2626 /// <summary>Initializes a new instance of the <see cref="ProgressToken"/> with a specified value.</summary>
2727 /// <param name="value">The required ID value.</param>
2828 public ProgressToken ( long value )
2929 {
3030 // Box the long. Progress tokens are almost always strings in practice, so this should be rare.
31- _id = value ;
31+ _token = value ;
3232 }
3333
34- /// <summary>Gets whether the identifier is uninitialized.</summary>
35- public bool IsDefault => _id is null ;
34+ /// <summary>Gets the underlying object for this token.</summary>
35+ /// <remarks>This will either be a <see cref="string"/>, a boxed <see cref="long"/>, or <see langword="null"/>.</remarks>
36+ public object ? Token => _token ;
3637
3738 /// <inheritdoc />
3839 public override string ? ToString ( ) =>
39- _id is string stringValue ? $ "\" { stringValue } \" " :
40- _id is long longValue ? longValue . ToString ( CultureInfo . InvariantCulture ) :
40+ _token is string stringValue ? $ "{ stringValue } " :
41+ _token is long longValue ? longValue . ToString ( CultureInfo . InvariantCulture ) :
4142 null ;
4243
4344 /// <summary>
4445 /// Compares this ProgressToken to another ProgressToken.
4546 /// </summary>
46- public bool Equals ( ProgressToken other ) => Equals ( _id , other . _id ) ;
47+ public bool Equals ( ProgressToken other ) => Equals ( _token , other . _token ) ;
4748
4849 /// <inheritdoc />
4950 public override bool Equals ( object ? obj ) => obj is ProgressToken other && Equals ( other ) ;
5051
5152 /// <inheritdoc />
52- public override int GetHashCode ( ) => _id ? . GetHashCode ( ) ?? 0 ;
53+ public override int GetHashCode ( ) => _token ? . GetHashCode ( ) ?? 0 ;
5354
5455 /// <summary>
5556 /// Compares two ProgressTokens for equality.
@@ -83,7 +84,7 @@ public override void Write(Utf8JsonWriter writer, ProgressToken value, JsonSeria
8384 {
8485 Throw . IfNull ( writer ) ;
8586
86- switch ( value . _id )
87+ switch ( value . _token )
8788 {
8889 case string str :
8990 writer . WriteStringValue ( str ) ;
0 commit comments