1- using ModelContextProtocol . Protocol . Messages ;
2- using ModelContextProtocol . Protocol . Types ;
1+ using ModelContextProtocol . Protocol . Types ;
32
43namespace ModelContextProtocol . Client ;
54
65/// <summary>
76/// Represents an instance of an MCP client connecting to a specific server.
87/// </summary>
9- public interface IMcpClient : IAsyncDisposable
8+ public interface IMcpClient : IMcpEndpoint
109{
1110 /// <summary>
1211 /// Gets the capabilities supported by the server.
@@ -24,40 +23,4 @@ public interface IMcpClient : IAsyncDisposable
2423 /// It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.
2524 /// </summary>
2625 string ? ServerInstructions { get ; }
27-
28- /// <summary>
29- /// Adds a handler for server notifications of a specific method.
30- /// </summary>
31- /// <param name="method">The notification method to handle.</param>
32- /// <param name="handler">The async handler function to process notifications.</param>
33- /// <remarks>
34- /// <para>
35- /// Each method may have multiple handlers. Adding a handler for a method that already has one
36- /// will not replace the existing handler.
37- /// </para>
38- /// <para>
39- /// <see cref="NotificationMethods"> provides constants for common notification methods.</see>
40- /// </para>
41- /// </remarks>
42- void AddNotificationHandler ( string method , Func < JsonRpcNotification , Task > handler ) ;
43-
44- /// <summary>
45- /// Sends a generic JSON-RPC request to the server.
46- /// </summary>
47- /// <typeparam name="TResult">The expected response type.</typeparam>
48- /// <param name="request">The JSON-RPC request to send.</param>
49- /// <param name="cancellationToken">A token to cancel the operation.</param>
50- /// <returns>A task containing the server's response.</returns>
51- /// <remarks>
52- /// It is recommended to use the capability-specific methods that use this one in their implementation.
53- /// Use this method for custom requests or those not yet covered explicitly.
54- /// </remarks>
55- Task < TResult > SendRequestAsync < TResult > ( JsonRpcRequest request , CancellationToken cancellationToken = default ) where TResult : class ;
56-
57- /// <summary>
58- /// Sends a message to the server.
59- /// </summary>
60- /// <param name="message">The message.</param>
61- /// <param name="cancellationToken">A token to cancel the operation.</param>
62- Task SendMessageAsync ( IJsonRpcMessage message , CancellationToken cancellationToken = default ) ;
6326}
0 commit comments