Table of Contents

Struct ProgressToken

Namespace
ModelContextProtocol.Protocol.Messages
Assembly
ModelContextProtocol.dll

Represents a progress token, which can be either a string or an integer.

[JsonConverter(typeof(ProgressToken.Converter))]
public readonly struct ProgressToken : IEquatable<ProgressToken>
Implements
Inherited Members

Constructors

ProgressToken(long)

Initializes a new instance of the ProgressToken with a specified value.

public ProgressToken(long value)

Parameters

value long

The required ID value.

ProgressToken(string)

Initializes a new instance of the ProgressToken with a specified value.

public ProgressToken(string value)

Parameters

value string

The required ID value.

Properties

Token

Gets the underlying object for this token.

public object? Token { get; }

Property Value

object

Remarks

This will either be a string, a boxed long, or null.

Methods

Equals(ProgressToken)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ProgressToken other)

Parameters

other ProgressToken

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string? ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(ProgressToken, ProgressToken)

public static bool operator ==(ProgressToken left, ProgressToken right)

Parameters

left ProgressToken
right ProgressToken

Returns

bool

operator !=(ProgressToken, ProgressToken)

public static bool operator !=(ProgressToken left, ProgressToken right)

Parameters

left ProgressToken
right ProgressToken

Returns

bool