Convert records to classes (#470)
* Convert records to classes * Make properties in SseClientTransportOptions settable. * Convert missing property from init to set
This commit is contained in:
parent
5cc7c00456
commit
47e6a6412e
9 changed files with 14 additions and 14 deletions
|
|
@ -3,7 +3,7 @@ namespace ModelContextProtocol.Client;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides options for configuring <see cref="SseClientTransport"/> instances.
|
/// Provides options for configuring <see cref="SseClientTransport"/> instances.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record SseClientTransportOptions
|
public class SseClientTransportOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the base address of the server for SSE connections.
|
/// Gets or sets the base address of the server for SSE connections.
|
||||||
|
|
@ -11,7 +11,7 @@ public record SseClientTransportOptions
|
||||||
public required Uri Endpoint
|
public required Uri Endpoint
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
init
|
set
|
||||||
{
|
{
|
||||||
if (value is null)
|
if (value is null)
|
||||||
{
|
{
|
||||||
|
|
@ -43,12 +43,12 @@ public record SseClientTransportOptions
|
||||||
/// <see href="https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse">HTTP with SSE transport specification</see>.
|
/// <see href="https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse">HTTP with SSE transport specification</see>.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public HttpTransportMode TransportMode { get; init; } = HttpTransportMode.AutoDetect;
|
public HttpTransportMode TransportMode { get; set; } = HttpTransportMode.AutoDetect;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a transport identifier used for logging purposes.
|
/// Gets a transport identifier used for logging purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Name { get; init; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a timeout used to establish the initial connection to the SSE server. Defaults to 30 seconds.
|
/// Gets or sets a timeout used to establish the initial connection to the SSE server. Defaults to 30 seconds.
|
||||||
|
|
@ -61,7 +61,7 @@ public record SseClientTransportOptions
|
||||||
/// </list>
|
/// </list>
|
||||||
/// If the timeout expires before the connection is established, a <see cref="TimeoutException"/> will be thrown.
|
/// If the timeout expires before the connection is established, a <see cref="TimeoutException"/> will be thrown.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public TimeSpan ConnectionTimeout { get; init; } = TimeSpan.FromSeconds(30);
|
public TimeSpan ConnectionTimeout { get; set; } = TimeSpan.FromSeconds(30);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets custom HTTP headers to include in requests to the SSE server.
|
/// Gets custom HTTP headers to include in requests to the SSE server.
|
||||||
|
|
@ -69,5 +69,5 @@ public record SseClientTransportOptions
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Use this property to specify custom HTTP headers that should be sent with each request to the server.
|
/// Use this property to specify custom HTTP headers that should be sent with each request to the server.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public Dictionary<string, string>? AdditionalHeaders { get; init; }
|
public Dictionary<string, string>? AdditionalHeaders { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ namespace ModelContextProtocol.Client;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides options for configuring <see cref="StdioClientTransport"/> instances.
|
/// Provides options for configuring <see cref="StdioClientTransport"/> instances.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record StdioClientTransportOptions
|
public class StdioClientTransportOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the command to execute to start the server process.
|
/// Gets or sets the command to execute to start the server process.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
namespace ModelContextProtocol;
|
namespace ModelContextProtocol;
|
||||||
|
|
||||||
/// <summary>Provides a progress value that can be sent using <see cref="IProgress{ProgressNotificationValue}"/>.</summary>
|
/// <summary>Provides a progress value that can be sent using <see cref="IProgress{ProgressNotificationValue}"/>.</summary>
|
||||||
public record struct ProgressNotificationValue
|
public class ProgressNotificationValue
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the progress thus far.
|
/// Gets or sets the progress thus far.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// Annotations enable filtering and prioritization of content for different audiences.
|
/// Annotations enable filtering and prioritization of content for different audiences.
|
||||||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public record Annotations
|
public class Annotations
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the intended audience for this content as an array of <see cref="Role"/> values.
|
/// Gets or sets the intended audience for this content as an array of <see cref="Role"/> values.
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public record InitializeResult
|
public class InitializeResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the version of the Model Context Protocol that the server will use for this session.
|
/// Gets or sets the version of the Model Context Protocol that the server will use for this session.
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// a standard format for error responses that includes a numeric code, a human-readable message,
|
/// a standard format for error responses that includes a numeric code, a human-readable message,
|
||||||
/// and optional additional data.
|
/// and optional additional data.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public record JsonRpcErrorDetail
|
public class JsonRpcErrorDetail
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an integer error code according to the JSON-RPC specification.
|
/// Gets an integer error code according to the JSON-RPC specification.
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,4 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// is still responsive.
|
/// is still responsive.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public record PingResult;
|
public class PingResult;
|
||||||
|
|
@ -8,7 +8,7 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public record Resource
|
public class Resource
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the URI of this resource.
|
/// Gets or sets the URI of this resource.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// Resource templates provide metadata about resources available on the server,
|
/// Resource templates provide metadata about resources available on the server,
|
||||||
/// including how to construct URIs for those resources.
|
/// including how to construct URIs for those resources.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public record ResourceTemplate
|
public class ResourceTemplate
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the URI template (according to RFC 6570) that can be used to construct resource URIs.
|
/// Gets or sets the URI template (according to RFC 6570) that can be used to construct resource URIs.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue