Table of Contents

Struct RequestId

Namespace
ModelContextProtocol.Protocol.Messages
Assembly
ModelContextProtocol.dll

Represents a JSON-RPC request identifier, which can be either a string or an integer.

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

Constructors

RequestId(long)

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

public RequestId(long value)

Parameters

value long

The required ID value.

RequestId(string)

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

public RequestId(string value)

Parameters

value string

The required ID value.

Properties

Id

Gets the underlying object for this id.

public object? Id { get; }

Property Value

object

Remarks

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

Methods

Equals(RequestId)

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

public bool Equals(RequestId other)

Parameters

other RequestId

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 ==(RequestId, RequestId)

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

Parameters

left RequestId
right RequestId

Returns

bool

operator !=(RequestId, RequestId)

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

Parameters

left RequestId
right RequestId

Returns

bool