Skip to content

Commit 6d4de36

Browse files
committed
fix: standardize resource not found error code
1 parent 301f8b0 commit 6d4de36

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

mcp-core/src/main/java/io/modelcontextprotocol/spec/McpSchema.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public static final class ErrorCodes {
151151
/**
152152
* Resource not found.
153153
*/
154-
public static final int RESOURCE_NOT_FOUND = -32002;
154+
public static final int RESOURCE_NOT_FOUND = INVALID_PARAMS;
155155

156156
/**
157157
* URL elicitation is required before the request can proceed.

mcp-core/src/test/java/io/modelcontextprotocol/spec/McpErrorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void testNotFound() {
1414
String uri = "file:///nonexistent.txt";
1515
McpError mcpError = McpError.RESOURCE_NOT_FOUND.apply(uri);
1616
assertNotNull(mcpError.getJsonRpcError());
17-
assertEquals(-32002, mcpError.getJsonRpcError().code());
17+
assertEquals(McpSchema.ErrorCodes.INVALID_PARAMS, mcpError.getJsonRpcError().code());
1818
assertEquals("Resource not found", mcpError.getJsonRpcError().message());
1919
assertEquals(Map.of("uri", uri), mcpError.getJsonRpcError().data());
2020
}

0 commit comments

Comments
 (0)