Skip to content

Commit 8068854

Browse files
authored
add access to server instructions (#148)
1 parent f348a83 commit 8068854

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

mcp/src/main/java/io/modelcontextprotocol/client/McpAsyncClient.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ public class McpAsyncClient {
112112
*/
113113
private McpSchema.ServerCapabilities serverCapabilities;
114114

115+
/**
116+
* Server instructions.
117+
*/
118+
private String serverInstructions;
119+
115120
/**
116121
* Server implementation information.
117122
*/
@@ -240,6 +245,15 @@ public McpSchema.ServerCapabilities getServerCapabilities() {
240245
return this.serverCapabilities;
241246
}
242247

248+
/**
249+
* Get the server instructions that provide guidance to the client on how to interact
250+
* with this server.
251+
* @return The server instructions
252+
*/
253+
public String getServerInstructions() {
254+
return this.serverInstructions;
255+
}
256+
243257
/**
244258
* Get the server implementation information.
245259
* @return The server implementation details
@@ -328,6 +342,7 @@ public Mono<McpSchema.InitializeResult> initialize() {
328342
return result.flatMap(initializeResult -> {
329343

330344
this.serverCapabilities = initializeResult.capabilities();
345+
this.serverInstructions = initializeResult.instructions();
331346
this.serverInfo = initializeResult.serverInfo();
332347

333348
logger.info("Server response with Protocol: {}, Capabilities: {}, Info: {} and Instructions {}",

mcp/src/main/java/io/modelcontextprotocol/client/McpSyncClient.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ public McpSchema.ServerCapabilities getServerCapabilities() {
7979
return this.delegate.getServerCapabilities();
8080
}
8181

82+
/**
83+
* Get the server instructions that provide guidance to the client on how to interact
84+
* with this server.
85+
* @return The instructions
86+
*/
87+
public String getServerInstructions() {
88+
return this.delegate.getServerInstructions();
89+
}
90+
8291
/**
8392
* Get the server implementation information.
8493
* @return The server implementation details

0 commit comments

Comments
 (0)