Deprecate McpErrorCode.ResourceNotFound (-32002) and use McpErrorCode.InvalidParams (-32602) per SEP-2164 (#1558)
This commit is contained in:
parent
712a06b83a
commit
b99d887b46
1 changed files with 77 additions and 15 deletions
|
|
@ -421,7 +421,13 @@ internal sealed partial class McpServerImpl : McpServer
|
|||
|
||||
listResourcesHandler ??= (static async (_, __) => new ListResourcesResult());
|
||||
listResourceTemplatesHandler ??= (static async (_, __) => new ListResourceTemplatesResult());
|
||||
readResourceHandler ??= (static async (request, _) => throw new McpProtocolException($"Unknown resource URI: '{request.Params?.Uri}'", McpErrorCode.ResourceNotFound));
|
||||
readResourceHandler ??= (static async (request, _) =>
|
||||
{
|
||||
var errorCode = McpHttpHeaders.UseInvalidParamsForMissingResource(request.Server.NegotiatedProtocolVersion)
|
||||
? McpErrorCode.InvalidParams
|
||||
: McpErrorCode.ResourceNotFound;
|
||||
throw new McpProtocolException($"Unknown resource URI: '{request.Params?.Uri}'", errorCode);
|
||||
});
|
||||
subscribeHandler ??= (static async (_, __) => new EmptyResult());
|
||||
unsubscribeHandler ??= (static async (_, __) => new EmptyResult());
|
||||
var listChanged = resourcesCapability?.ListChanged;
|
||||
|
|
|
|||
Loading…
Reference in a new issue