Skip to content

Commit 92db0a0

Browse files
chemicLtzolov
authored andcommitted
Correct McpError messages
1 parent fd76268 commit 92db0a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ public Mono<McpSchema.ListToolsResult> listTools() {
492492
*/
493493
public Mono<McpSchema.ListToolsResult> listTools(String cursor) {
494494
if (!this.isInitialized()) {
495-
return Mono.error(new McpError("Client must be initialized before calling tools"));
495+
return Mono.error(new McpError("Client must be initialized before listing tools"));
496496
}
497497
if (this.serverCapabilities.tools() == null) {
498498
return Mono.error(new McpError("Server does not provide tools capability"));
@@ -553,7 +553,7 @@ public Mono<McpSchema.ListResourcesResult> listResources() {
553553
*/
554554
public Mono<McpSchema.ListResourcesResult> listResources(String cursor) {
555555
if (!this.isInitialized()) {
556-
return Mono.error(new McpError("Client must be initialized before calling tools"));
556+
return Mono.error(new McpError("Client must be initialized before listing resources"));
557557
}
558558
if (this.serverCapabilities.resources() == null) {
559559
return Mono.error(new McpError("Server does not provide the resources capability"));
@@ -578,7 +578,7 @@ public Mono<McpSchema.ReadResourceResult> readResource(McpSchema.Resource resour
578578
*/
579579
public Mono<McpSchema.ReadResourceResult> readResource(McpSchema.ReadResourceRequest readResourceRequest) {
580580
if (!this.isInitialized()) {
581-
return Mono.error(new McpError("Client must be initialized before calling tools"));
581+
return Mono.error(new McpError("Client must be initialized before reading resources"));
582582
}
583583
if (this.serverCapabilities.resources() == null) {
584584
return Mono.error(new McpError("Server does not provide the resources capability"));
@@ -608,7 +608,7 @@ public Mono<McpSchema.ListResourceTemplatesResult> listResourceTemplates() {
608608
*/
609609
public Mono<McpSchema.ListResourceTemplatesResult> listResourceTemplates(String cursor) {
610610
if (!this.isInitialized()) {
611-
return Mono.error(new McpError("Client must be initialized before calling tools"));
611+
return Mono.error(new McpError("Client must be initialized before listing resource templates"));
612612
}
613613
if (this.serverCapabilities.resources() == null) {
614614
return Mono.error(new McpError("Server does not provide the resources capability"));

0 commit comments

Comments
 (0)