add access to server instructions (#148)

This commit is contained in:
James Ward 2025-04-14 23:41:41 -06:00 • committed by GitHub
commit 8068854227
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View file

@ -112,6 +112,11 @@ public class McpAsyncClient {
*/
private McpSchema.ServerCapabilities serverCapabilities;
/**
* Server instructions.
*/
private String serverInstructions;
/**
* Server implementation information.
*/
@ -240,6 +245,15 @@ public class McpAsyncClient {
return this.serverCapabilities;
}
/**
* Get the server instructions that provide guidance to the client on how to interact
* with this server.
* @return The server instructions
*/
public String getServerInstructions() {
return this.serverInstructions;
}
/**
* Get the server implementation information.
* @return The server implementation details
@ -328,6 +342,7 @@ public class McpAsyncClient {
return result.flatMap(initializeResult -> {
this.serverCapabilities = initializeResult.capabilities();
this.serverInstructions = initializeResult.instructions();
this.serverInfo = initializeResult.serverInfo();
logger.info("Server response with Protocol: {}, Capabilities: {}, Info: {} and Instructions {}",

View file

@ -79,6 +79,15 @@ public class McpSyncClient implements AutoCloseable {
return this.delegate.getServerCapabilities();
}
/**
* Get the server instructions that provide guidance to the client on how to interact
* with this server.
* @return The instructions
*/
public String getServerInstructions() {
return this.delegate.getServerInstructions();
}
/**
* Get the server implementation information.
* @return The server implementation details