fix: correct typos and improve documentation (#35)
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
parent
c3a7c1ac1e
commit
cd624a7d57
6 changed files with 15 additions and 7 deletions
|
|
@ -97,7 +97,7 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- The Spring Context is required due to the reactor-netty connector being dependant on
|
<!-- The Spring Context is required due to the reactor-netty connector being dependent on
|
||||||
the Spring Lifecycle, as discussed here:
|
the Spring Lifecycle, as discussed here:
|
||||||
https://github.com/spring-projects/spring-framework/issues/31180 -->
|
https://github.com/spring-projects/spring-framework/issues/31180 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ public class McpAsyncClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------
|
// --------------------------
|
||||||
// Basic Utilites
|
// Basic Utilities
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -751,6 +751,14 @@ public class McpAsyncClient {
|
||||||
// --------------------------
|
// --------------------------
|
||||||
// Logging
|
// Logging
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
/**
|
||||||
|
* Create a notification handler for logging notifications from the server. This
|
||||||
|
* handler automatically distributes logging messages to all registered consumers.
|
||||||
|
* @param loggingConsumers List of consumers that will be notified when a logging
|
||||||
|
* message is received. Each consumer receives the logging message notification.
|
||||||
|
* @return A NotificationHandler that processes log notifications by distributing the
|
||||||
|
* message to all registered consumers
|
||||||
|
*/
|
||||||
private NotificationHandler asyncLoggingNotificationHandler(
|
private NotificationHandler asyncLoggingNotificationHandler(
|
||||||
List<Function<LoggingMessageNotification, Mono<Void>>> loggingConsumers) {
|
List<Function<LoggingMessageNotification, Mono<Void>>> loggingConsumers) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ public class HttpClientSseClientTransport implements McpClientTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unmarshals data to the specified type using the configured object mapper.
|
* Unmarshal data to the specified type using the configured object mapper.
|
||||||
* @param data the data to unmarshal
|
* @param data the data to unmarshal
|
||||||
* @param typeRef the type reference for the target type
|
* @param typeRef the type reference for the target type
|
||||||
* @param <T> the target type
|
* @param <T> the target type
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ public class StdioClientTransport implements McpClientTransport {
|
||||||
*/
|
*/
|
||||||
private void startOutboundProcessing() {
|
private void startOutboundProcessing() {
|
||||||
this.handleOutbound(messages -> messages
|
this.handleOutbound(messages -> messages
|
||||||
// this bit is important since writes come from user threads and we
|
// this bit is important since writes come from user threads, and we
|
||||||
// want to ensure that the actual writing happens on a dedicated thread
|
// want to ensure that the actual writing happens on a dedicated thread
|
||||||
.publishOn(outboundScheduler)
|
.publishOn(outboundScheduler)
|
||||||
.handle((message, s) -> {
|
.handle((message, s) -> {
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ public class McpClientSession implements McpSession {
|
||||||
public McpClientSession(Duration requestTimeout, McpClientTransport transport,
|
public McpClientSession(Duration requestTimeout, McpClientTransport transport,
|
||||||
Map<String, RequestHandler<?>> requestHandlers, Map<String, NotificationHandler> notificationHandlers) {
|
Map<String, RequestHandler<?>> requestHandlers, Map<String, NotificationHandler> notificationHandlers) {
|
||||||
|
|
||||||
Assert.notNull(requestTimeout, "The requstTimeout can not be null");
|
Assert.notNull(requestTimeout, "The requestTimeout can not be null");
|
||||||
Assert.notNull(transport, "The transport can not be null");
|
Assert.notNull(transport, "The transport can not be null");
|
||||||
Assert.notNull(requestHandlers, "The requestHandlers can not be null");
|
Assert.notNull(requestHandlers, "The requestHandlers can not be null");
|
||||||
Assert.notNull(notificationHandlers, "The notificationHandlers can not be null");
|
Assert.notNull(notificationHandlers, "The notificationHandlers can not be null");
|
||||||
|
|
@ -127,7 +127,7 @@ public class McpClientSession implements McpSession {
|
||||||
logger.debug("Received Response: {}", response);
|
logger.debug("Received Response: {}", response);
|
||||||
var sink = pendingResponses.remove(response.id());
|
var sink = pendingResponses.remove(response.id());
|
||||||
if (sink == null) {
|
if (sink == null) {
|
||||||
logger.warn("Unexpected response for unkown id {}", response.id());
|
logger.warn("Unexpected response for unknown id {}", response.id());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sink.success(response);
|
sink.success(response);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class McpClientSessionTests {
|
||||||
void testConstructorWithInvalidArguments() {
|
void testConstructorWithInvalidArguments() {
|
||||||
assertThatThrownBy(() -> new McpClientSession(null, transport, Map.of(), Map.of()))
|
assertThatThrownBy(() -> new McpClientSession(null, transport, Map.of(), Map.of()))
|
||||||
.isInstanceOf(IllegalArgumentException.class)
|
.isInstanceOf(IllegalArgumentException.class)
|
||||||
.hasMessageContaining("requstTimeout can not be null");
|
.hasMessageContaining("The requestTimeout can not be null");
|
||||||
|
|
||||||
assertThatThrownBy(() -> new McpClientSession(TIMEOUT, null, Map.of(), Map.of()))
|
assertThatThrownBy(() -> new McpClientSession(TIMEOUT, null, Map.of(), Map.of()))
|
||||||
.isInstanceOf(IllegalArgumentException.class)
|
.isInstanceOf(IllegalArgumentException.class)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue