Commit 569e52a6 authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Merge branch '3-search-of-services-and-products-specifications-returns-empty-result' into 'develop'

Resolve "Search of services and products  specifications returns empty result"

See merge request !4
parents 4dd0e7ec 81d61cb0
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -177,7 +177,7 @@ public class ProductCatalogTools {
    // Filter and get result as JSON string
    // Filter and get result as JSON string
    try {
    try {


      String[] tokens = {"id", "name", "description", "isBundle", "@type", "configurable", "valueType", "isBundle" };
      String[] tokens = {"productOfferingId", "productName", "productDescription", "isBundle", "@type", "isBundle", "categoryName" };
      JsonNode filtered = JsonMassage.filterJsonByTokens( spec, tokens);
      JsonNode filtered = JsonMassage.filterJsonByTokens( spec, tokens);
      return filtered;
      return filtered;
    } catch (Exception e) {
    } catch (Exception e) {
+10 −1
Original line number Original line Diff line number Diff line
@@ -31,10 +31,12 @@ import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
import org.etsi.osl.tmf.so641.model.ServiceRestriction;
import org.etsi.osl.tmf.so641.model.ServiceRestriction;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.ai.chat.model.ToolContext;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.ParameterizedTypeReference;
//import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.client.RestClient;
import org.springframework.web.client.RestClient;
import jakarta.validation.Valid;
import jakarta.validation.Valid;


@@ -55,6 +57,13 @@ public class ServiceCatalogTools {
  ServiceCatalogQClient aCatalogClient;
  ServiceCatalogQClient aCatalogClient;


  
  
//  @Tool(description="Get your name")
//  public String getYourName(ToolContext context) {
//    logger.info("ToolContext: {}", McpRequestHolder.get(context).headers());
//      return SecurityContextHolder.getContext().getAuthentication().getName();
//  }
  
  
  @Tool(description = "Get a list of all published OSL OpenSlice service catalogs."
  @Tool(description = "Get a list of all published OSL OpenSlice service catalogs."
      + "Each catalog contains service categories, that we can search individually to get the details and contents of each category.")
      + "Each catalog contains service categories, that we can search individually to get the details and contents of each category.")
  public JsonNode getOSLServiceCatalogs() {
  public JsonNode getOSLServiceCatalogs() {
@@ -191,7 +200,7 @@ public class ServiceCatalogTools {
    // Filter and get result as JSON string
    // Filter and get result as JSON string
    try {
    try {


      String[] tokens = {"id", "name", "description", "@type", "configurable", "valueType", "isBundle" };
      String[] tokens = {"serviceSpecificationId", "serviceName", "serviceDescription", "@type",  "isBundle", "categoryName" };
      JsonNode filtered = JsonMassage.filterJsonByTokens( spec, tokens);
      JsonNode filtered = JsonMassage.filterJsonByTokens( spec, tokens);
      return filtered;
      return filtered;
    } catch (Exception e) {
    } catch (Exception e) {