Skip to content

Commit cb0066d

Browse files
committed
Fix missing renames
1 parent 81bcae0 commit cb0066d

File tree

5 files changed

+31
-31
lines changed

5 files changed

+31
-31
lines changed

src/ModelContextProtocol.Core/McpSession.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public abstract class McpSession : IAsyncDisposable
6565
/// <para>
6666
/// This method provides low-level access to send any JSON-RPC message. For specific message types,
6767
/// consider using the higher-level methods such as <see cref="SendRequestAsync"/> or extension methods
68-
/// like <see cref="McpEndpointExtensions.SendNotificationAsync(McpSession, string, CancellationToken)"/>,
68+
/// like <see cref="McpSessionExtensions.SendNotificationAsync(McpSession, string, CancellationToken)"/>,
6969
/// which provide a simpler API.
7070
/// </para>
7171
/// <para>

src/ModelContextProtocol.Core/McpEndpointExtensions.cs renamed to src/ModelContextProtocol.Core/McpSessionExtensions.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@ namespace ModelContextProtocol;
1212
/// </summary>
1313
/// <remarks>
1414
/// <para>
15-
/// This class provides strongly-typed methods for working with the Model Context Protocol (MCP) endpoints,
15+
/// This class provides strongly-typed methods for working with the Model Context Protocol (MCP) sessions,
1616
/// simplifying JSON-RPC communication by handling serialization and deserialization of parameters and results.
1717
/// </para>
1818
/// <para>
1919
/// These extension methods are designed to be used with both client (<see cref="McpClient"/>) and
2020
/// server (<see cref="McpServerImpl"/>) implementations of the <see cref="McpSession"/> interface.
2121
/// </para>
2222
/// </remarks>
23-
public static class McpEndpointExtensions
23+
public static class McpSessionExtensions
2424
{
2525
/// <summary>
2626
/// Sends a JSON-RPC request and attempts to deserialize the result to <typeparamref name="TResult"/>.
2727
/// </summary>
2828
/// <typeparam name="TParameters">The type of the request parameters to serialize from.</typeparam>
2929
/// <typeparam name="TResult">The type of the result to deserialize to.</typeparam>
30-
/// <param name="endpoint">The MCP client or server instance.</param>
30+
/// <param name="session">The MCP client or server instance.</param>
3131
/// <param name="method">The JSON-RPC method name to invoke.</param>
3232
/// <param name="parameters">Object representing the request parameters.</param>
3333
/// <param name="requestId">The request id for the request.</param>
3434
/// <param name="serializerOptions">The options governing request serialization.</param>
3535
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
3636
/// <returns>A task that represents the asynchronous operation. The task result contains the deserialized result.</returns>
3737
public static ValueTask<TResult> SendRequestAsync<TParameters, TResult>(
38-
this McpSession endpoint,
38+
this McpSession session,
3939
string method,
4040
TParameters parameters,
4141
JsonSerializerOptions? serializerOptions = null,
@@ -48,15 +48,15 @@ public static ValueTask<TResult> SendRequestAsync<TParameters, TResult>(
4848

4949
JsonTypeInfo<TParameters> paramsTypeInfo = serializerOptions.GetTypeInfo<TParameters>();
5050
JsonTypeInfo<TResult> resultTypeInfo = serializerOptions.GetTypeInfo<TResult>();
51-
return SendRequestAsync(endpoint, method, parameters, paramsTypeInfo, resultTypeInfo, requestId, cancellationToken);
51+
return SendRequestAsync(session, method, parameters, paramsTypeInfo, resultTypeInfo, requestId, cancellationToken);
5252
}
5353

5454
/// <summary>
5555
/// Sends a JSON-RPC request and attempts to deserialize the result to <typeparamref name="TResult"/>.
5656
/// </summary>
5757
/// <typeparam name="TParameters">The type of the request parameters to serialize from.</typeparam>
5858
/// <typeparam name="TResult">The type of the result to deserialize to.</typeparam>
59-
/// <param name="endpoint">The MCP client or server instance.</param>
59+
/// <param name="session">The MCP client or server instance.</param>
6060
/// <param name="method">The JSON-RPC method name to invoke.</param>
6161
/// <param name="parameters">Object representing the request parameters.</param>
6262
/// <param name="parametersTypeInfo">The type information for request parameter serialization.</param>
@@ -65,7 +65,7 @@ public static ValueTask<TResult> SendRequestAsync<TParameters, TResult>(
6565
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
6666
/// <returns>A task that represents the asynchronous operation. The task result contains the deserialized result.</returns>
6767
internal static async ValueTask<TResult> SendRequestAsync<TParameters, TResult>(
68-
this McpSession endpoint,
68+
this McpSession session,
6969
string method,
7070
TParameters parameters,
7171
JsonTypeInfo<TParameters> parametersTypeInfo,
@@ -74,7 +74,7 @@ internal static async ValueTask<TResult> SendRequestAsync<TParameters, TResult>(
7474
CancellationToken cancellationToken = default)
7575
where TResult : notnull
7676
{
77-
Throw.IfNull(endpoint);
77+
Throw.IfNull(session);
7878
Throw.IfNullOrWhiteSpace(method);
7979
Throw.IfNull(parametersTypeInfo);
8080
Throw.IfNull(resultTypeInfo);
@@ -86,12 +86,12 @@ internal static async ValueTask<TResult> SendRequestAsync<TParameters, TResult>(
8686
Params = JsonSerializer.SerializeToNode(parameters, parametersTypeInfo),
8787
};
8888

89-
JsonRpcResponse response = await endpoint.SendRequestAsync(jsonRpcRequest, cancellationToken).ConfigureAwait(false);
89+
JsonRpcResponse response = await session.SendRequestAsync(jsonRpcRequest, cancellationToken).ConfigureAwait(false);
9090
return JsonSerializer.Deserialize(response.Result, resultTypeInfo) ?? throw new JsonException("Unexpected JSON result in response.");
9191
}
9292

9393
/// <summary>
94-
/// Sends a parameterless notification to the connected endpoint.
94+
/// Sends a parameterless notification to the connected session.
9595
/// </summary>
9696
/// <param name="client">The MCP client or server instance.</param>
9797
/// <param name="method">The notification method name.</param>
@@ -112,18 +112,18 @@ public static Task SendNotificationAsync(this McpSession client, string method,
112112
}
113113

114114
/// <summary>
115-
/// Sends a notification with parameters to the connected endpoint.
115+
/// Sends a notification with parameters to the connected session.
116116
/// </summary>
117117
/// <typeparam name="TParameters">The type of the notification parameters to serialize.</typeparam>
118-
/// <param name="endpoint">The MCP client or server instance.</param>
118+
/// <param name="session">The MCP client or server instance.</param>
119119
/// <param name="method">The JSON-RPC method name for the notification.</param>
120120
/// <param name="parameters">Object representing the notification parameters.</param>
121121
/// <param name="serializerOptions">The options governing parameter serialization. If null, default options are used.</param>
122122
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
123123
/// <returns>A task that represents the asynchronous send operation.</returns>
124124
/// <remarks>
125125
/// <para>
126-
/// This method sends a notification with parameters to the connected endpoint. Notifications are one-way
126+
/// This method sends a notification with parameters to the connected session. Notifications are one-way
127127
/// messages that don't expect a response, commonly used for events, status updates, or signaling changes.
128128
/// </para>
129129
/// <para>
@@ -136,7 +136,7 @@ public static Task SendNotificationAsync(this McpSession client, string method,
136136
/// </para>
137137
/// </remarks>
138138
public static Task SendNotificationAsync<TParameters>(
139-
this McpSession endpoint,
139+
this McpSession session,
140140
string method,
141141
TParameters parameters,
142142
JsonSerializerOptions? serializerOptions = null,
@@ -146,44 +146,44 @@ public static Task SendNotificationAsync<TParameters>(
146146
serializerOptions.MakeReadOnly();
147147

148148
JsonTypeInfo<TParameters> parametersTypeInfo = serializerOptions.GetTypeInfo<TParameters>();
149-
return SendNotificationAsync(endpoint, method, parameters, parametersTypeInfo, cancellationToken);
149+
return SendNotificationAsync(session, method, parameters, parametersTypeInfo, cancellationToken);
150150
}
151151

152152
/// <summary>
153153
/// Sends a notification to the server with parameters.
154154
/// </summary>
155-
/// <param name="endpoint">The MCP client or server instance.</param>
155+
/// <param name="session">The MCP client or server instance.</param>
156156
/// <param name="method">The JSON-RPC method name to invoke.</param>
157157
/// <param name="parameters">Object representing the request parameters.</param>
158158
/// <param name="parametersTypeInfo">The type information for request parameter serialization.</param>
159159
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
160160
internal static Task SendNotificationAsync<TParameters>(
161-
this McpSession endpoint,
161+
this McpSession session,
162162
string method,
163163
TParameters parameters,
164164
JsonTypeInfo<TParameters> parametersTypeInfo,
165165
CancellationToken cancellationToken = default)
166166
{
167-
Throw.IfNull(endpoint);
167+
Throw.IfNull(session);
168168
Throw.IfNullOrWhiteSpace(method);
169169
Throw.IfNull(parametersTypeInfo);
170170

171171
JsonNode? parametersJson = JsonSerializer.SerializeToNode(parameters, parametersTypeInfo);
172-
return endpoint.SendMessageAsync(new JsonRpcNotification { Method = method, Params = parametersJson }, cancellationToken);
172+
return session.SendMessageAsync(new JsonRpcNotification { Method = method, Params = parametersJson }, cancellationToken);
173173
}
174174

175175
/// <summary>
176-
/// Notifies the connected endpoint of progress for a long-running operation.
176+
/// Notifies the connected session of progress for a long-running operation.
177177
/// </summary>
178-
/// <param name="endpoint">The endpoint issuing the notification.</param>
178+
/// <param name="session">The session issuing the notification.</param>
179179
/// <param name="progressToken">The <see cref="ProgressToken"/> identifying the operation for which progress is being reported.</param>
180180
/// <param name="progress">The progress update to send, containing information such as percentage complete or status message.</param>
181181
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
182182
/// <returns>A task representing the completion of the notification operation (not the operation being tracked).</returns>
183-
/// <exception cref="ArgumentNullException"><paramref name="endpoint"/> is <see langword="null"/>.</exception>
183+
/// <exception cref="ArgumentNullException"><paramref name="session"/> is <see langword="null"/>.</exception>
184184
/// <remarks>
185185
/// <para>
186-
/// This method sends a progress notification to the connected endpoint using the Model Context Protocol's
186+
/// This method sends a progress notification to the connected session using the Model Context Protocol's
187187
/// standardized progress notification format. Progress updates are identified by a <see cref="ProgressToken"/>
188188
/// that allows the recipient to correlate multiple updates with a specific long-running operation.
189189
/// </para>
@@ -192,14 +192,14 @@ internal static Task SendNotificationAsync<TParameters>(
192192
/// </para>
193193
/// </remarks>
194194
public static Task NotifyProgressAsync(
195-
this McpSession endpoint,
195+
this McpSession session,
196196
ProgressToken progressToken,
197197
ProgressNotificationValue progress,
198198
CancellationToken cancellationToken = default)
199199
{
200-
Throw.IfNull(endpoint);
200+
Throw.IfNull(session);
201201

202-
return endpoint.SendNotificationAsync(
202+
return session.SendNotificationAsync(
203203
NotificationMethods.ProgressNotification,
204204
new ProgressNotificationParams
205205
{

src/ModelContextProtocol.Core/Protocol/ITransport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public interface ITransport : IAsyncDisposable
6363
/// <para>
6464
/// This is a core method used by higher-level abstractions in the MCP protocol implementation.
6565
/// Most client code should use the higher-level methods provided by <see cref="McpSession"/>,
66-
/// <see cref="McpEndpointExtensions"/>, <see cref="McpClientExtensions"/>, or <see cref="McpServerExtensions"/>,
66+
/// <see cref="McpSessionExtensions"/>, <see cref="McpClientExtensions"/>, or <see cref="McpServerExtensions"/>,
6767
/// rather than accessing this method directly.
6868
/// </para>
6969
/// </remarks>

src/ModelContextProtocol.Core/Server/DestinationBoundMcpServerSession.cs renamed to src/ModelContextProtocol.Core/Server/DestinationBoundMcpServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace ModelContextProtocol.Server;
55

6-
internal sealed class DestinationBoundMcpServerSession(McpServerImpl server, ITransport? transport) : McpServer
6+
internal sealed class DestinationBoundMcpServer(McpServerImpl server, ITransport? transport) : McpServer
77
{
88
public override string? SessionId => transport?.SessionId ?? server.SessionId;
99
public override ClientCapabilities? ClientCapabilities => server.ClientCapabilities;

src/ModelContextProtocol.Core/Server/McpServerImpl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ private ValueTask<TResult> InvokeHandlerAsync<TParams, TResult>(
561561
{
562562
return _servicesScopePerRequest ?
563563
InvokeScopedAsync(handler, args, cancellationToken) :
564-
handler(new(new DestinationBoundMcpServerSession(this, destinationTransport)) { Params = args }, cancellationToken);
564+
handler(new(new DestinationBoundMcpServer(this, destinationTransport)) { Params = args }, cancellationToken);
565565

566566
async ValueTask<TResult> InvokeScopedAsync(
567567
Func<RequestContext<TParams>, CancellationToken, ValueTask<TResult>> handler,
@@ -572,7 +572,7 @@ async ValueTask<TResult> InvokeScopedAsync(
572572
try
573573
{
574574
return await handler(
575-
new RequestContext<TParams>(new DestinationBoundMcpServerSession(this, destinationTransport))
575+
new RequestContext<TParams>(new DestinationBoundMcpServer(this, destinationTransport))
576576
{
577577
Services = scope?.ServiceProvider ?? Services,
578578
Params = args

0 commit comments

Comments
 (0)