Skip to content

Commit 47e6a64

Browse files
Convert records to classes (#470)
* Convert records to classes * Make properties in SseClientTransportOptions settable. * Convert missing property from init to set
1 parent 5cc7c00 commit 47e6a64

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

src/ModelContextProtocol/Client/SseClientTransportOptions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ namespace ModelContextProtocol.Client;
33
/// <summary>
44
/// Provides options for configuring <see cref="SseClientTransport"/> instances.
55
/// </summary>
6-
public record SseClientTransportOptions
6+
public class SseClientTransportOptions
77
{
88
/// <summary>
99
/// Gets or sets the base address of the server for SSE connections.
1010
/// </summary>
1111
public required Uri Endpoint
1212
{
1313
get;
14-
init
14+
set
1515
{
1616
if (value is null)
1717
{
@@ -43,12 +43,12 @@ public required Uri Endpoint
4343
/// <see href="https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse">HTTP with SSE transport specification</see>.
4444
/// </para>
4545
/// </remarks>
46-
public HttpTransportMode TransportMode { get; init; } = HttpTransportMode.AutoDetect;
46+
public HttpTransportMode TransportMode { get; set; } = HttpTransportMode.AutoDetect;
4747

4848
/// <summary>
4949
/// Gets a transport identifier used for logging purposes.
5050
/// </summary>
51-
public string? Name { get; init; }
51+
public string? Name { get; set; }
5252

5353
/// <summary>
5454
/// Gets or sets a timeout used to establish the initial connection to the SSE server. Defaults to 30 seconds.
@@ -61,13 +61,13 @@ public required Uri Endpoint
6161
/// </list>
6262
/// If the timeout expires before the connection is established, a <see cref="TimeoutException"/> will be thrown.
6363
/// </remarks>
64-
public TimeSpan ConnectionTimeout { get; init; } = TimeSpan.FromSeconds(30);
64+
public TimeSpan ConnectionTimeout { get; set; } = TimeSpan.FromSeconds(30);
6565

6666
/// <summary>
6767
/// Gets custom HTTP headers to include in requests to the SSE server.
6868
/// </summary>
6969
/// <remarks>
7070
/// Use this property to specify custom HTTP headers that should be sent with each request to the server.
7171
/// </remarks>
72-
public Dictionary<string, string>? AdditionalHeaders { get; init; }
72+
public Dictionary<string, string>? AdditionalHeaders { get; set; }
7373
}

src/ModelContextProtocol/Client/StdioClientTransportOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace ModelContextProtocol.Client;
33
/// <summary>
44
/// Provides options for configuring <see cref="StdioClientTransport"/> instances.
55
/// </summary>
6-
public record StdioClientTransportOptions
6+
public class StdioClientTransportOptions
77
{
88
/// <summary>
99
/// Gets or sets the command to execute to start the server process.

src/ModelContextProtocol/ProgressNotificationValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace ModelContextProtocol;
22

33
/// <summary>Provides a progress value that can be sent using <see cref="IProgress{ProgressNotificationValue}"/>.</summary>
4-
public record struct ProgressNotificationValue
4+
public class ProgressNotificationValue
55
{
66
/// <summary>
77
/// Gets or sets the progress thus far.

src/ModelContextProtocol/Protocol/Annotations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace ModelContextProtocol.Protocol;
99
/// Annotations enable filtering and prioritization of content for different audiences.
1010
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
1111
/// </remarks>
12-
public record Annotations
12+
public class Annotations
1313
{
1414
/// <summary>
1515
/// Gets or sets the intended audience for this content as an array of <see cref="Role"/> values.

src/ModelContextProtocol/Protocol/InitializeResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace ModelContextProtocol.Protocol;
1919
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
2020
/// </para>
2121
/// </remarks>
22-
public record InitializeResult
22+
public class InitializeResult
2323
{
2424
/// <summary>
2525
/// Gets or sets the version of the Model Context Protocol that the server will use for this session.

src/ModelContextProtocol/Protocol/JsonRpcErrorDetail.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace ModelContextProtocol.Protocol;
1111
/// a standard format for error responses that includes a numeric code, a human-readable message,
1212
/// and optional additional data.
1313
/// </remarks>
14-
public record JsonRpcErrorDetail
14+
public class JsonRpcErrorDetail
1515
{
1616
/// <summary>
1717
/// Gets an integer error code according to the JSON-RPC specification.

src/ModelContextProtocol/Protocol/PingResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ namespace ModelContextProtocol.Protocol;
1414
/// is still responsive.
1515
/// </para>
1616
/// </remarks>
17-
public record PingResult;
17+
public class PingResult;

src/ModelContextProtocol/Protocol/Resource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ModelContextProtocol.Protocol;
88
/// <remarks>
99
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
1010
/// </remarks>
11-
public record Resource
11+
public class Resource
1212
{
1313
/// <summary>
1414
/// Gets or sets the URI of this resource.

src/ModelContextProtocol/Protocol/ResourceTemplate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace ModelContextProtocol.Protocol;
99
/// Resource templates provide metadata about resources available on the server,
1010
/// including how to construct URIs for those resources.
1111
/// </remarks>
12-
public record ResourceTemplate
12+
public class ResourceTemplate
1313
{
1414
/// <summary>
1515
/// Gets or sets the URI template (according to RFC 6570) that can be used to construct resource URIs.

0 commit comments

Comments
 (0)