diff --git a/src/core/mcp/include/sourcemeta/core/mcp.h b/src/core/mcp/include/sourcemeta/core/mcp.h index eb4b75dd68..8d4c87c9aa 100644 --- a/src/core/mcp/include/sourcemeta/core/mcp.h +++ b/src/core/mcp/include/sourcemeta/core/mcp.h @@ -321,13 +321,12 @@ auto mcp_make_tool_error(const sourcemeta::core::JSON &identifier, /// #include /// /// const auto identifier{sourcemeta::core::JSON{3}}; -/// const auto envelope{sourcemeta::core::mcp_make_error_resource_not_found( -/// identifier, "file:///missing")}; +/// const auto envelope{ +/// sourcemeta::core::mcp_make_error_resource_not_found(identifier)}; /// assert(envelope.at("error").at("code").to_integer() == -32002); /// ``` SOURCEMETA_CORE_MCP_EXPORT -auto mcp_make_error_resource_not_found(const sourcemeta::core::JSON &identifier, - const JSON::StringView uri) +auto mcp_make_error_resource_not_found(const sourcemeta::core::JSON &identifier) -> sourcemeta::core::JSON; /// @ingroup mcp diff --git a/src/core/mcp/mcp.cc b/src/core/mcp/mcp.cc index 1585ae3c74..969a9587a3 100644 --- a/src/core/mcp/mcp.cc +++ b/src/core/mcp/mcp.cc @@ -178,12 +178,10 @@ auto mcp_make_tool_error(const sourcemeta::core::JSON &identifier, std::move(envelope_result)); } -auto mcp_make_error_resource_not_found(const sourcemeta::core::JSON &identifier, - const JSON::StringView uri) +auto mcp_make_error_resource_not_found(const sourcemeta::core::JSON &identifier) -> sourcemeta::core::JSON { return sourcemeta::core::jsonrpc_make_error( - &identifier, MCP_CODE_RESOURCE_NOT_FOUND, "Resource not found", - sourcemeta::core::JSON{uri}); + &identifier, MCP_CODE_RESOURCE_NOT_FOUND, "Resource not found"); } auto mcp_make_resource(const JSON::StringView uri, const JSON::StringView name, diff --git a/test/mcp/mcp_test.cc b/test/mcp/mcp_test.cc index 87e58b01d8..60aa86a9f4 100644 --- a/test/mcp/mcp_test.cc +++ b/test/mcp/mcp_test.cc @@ -564,15 +564,14 @@ TEST(MCP, tool_error_with_null_id) { TEST(MCP, error_resource_not_found_with_integer_id) { const auto identifier{sourcemeta::core::JSON{3}}; - const auto envelope{sourcemeta::core::mcp_make_error_resource_not_found( - identifier, "file:///missing")}; + const auto envelope{ + sourcemeta::core::mcp_make_error_resource_not_found(identifier)}; const auto expected{sourcemeta::core::parse_json(R"JSON({ "jsonrpc": "2.0", "id": 3, "error": { "code": -32002, - "message": "Resource not found", - "data": "file:///missing" + "message": "Resource not found" } })JSON")}; EXPECT_EQ(envelope, expected); @@ -580,15 +579,14 @@ TEST(MCP, error_resource_not_found_with_integer_id) { TEST(MCP, error_resource_not_found_with_string_id) { const auto identifier{sourcemeta::core::JSON{"req-7"}}; - const auto envelope{sourcemeta::core::mcp_make_error_resource_not_found( - identifier, "file:///missing")}; + const auto envelope{ + sourcemeta::core::mcp_make_error_resource_not_found(identifier)}; const auto expected{sourcemeta::core::parse_json(R"JSON({ "jsonrpc": "2.0", "id": "req-7", "error": { "code": -32002, - "message": "Resource not found", - "data": "file:///missing" + "message": "Resource not found" } })JSON")}; EXPECT_EQ(envelope, expected);