Class ServiceTarget

java.lang.Object
ai.wanaku.core.mcp.providers.ServiceTarget

public class ServiceTarget extends Object
Represents a target service endpoint that can be either a resource provider or a tool invoker.
  • Constructor Details

    • ServiceTarget

      public ServiceTarget(String service, String host, int port, ServiceType serviceType)
      Constructs a new instance of ServiceTarget.
      Parameters:
      service - The name of the service.
      host - The host address of the service.
      port - The port number of the service.
      serviceType - The type of service, either RESOURCE_PROVIDER or TOOL_INVOKER.
  • Method Details

    • getService

      public String getService()
      Gets the name of the service.
      Returns:
      The name of the service.
    • getHost

      public String getHost()
      Gets the host address of the service.
      Returns:
      The host address of the service.
    • getPort

      public int getPort()
      Gets the port number of the service.
      Returns:
      The port number of the service.
    • getServiceType

      public ServiceType getServiceType()
      Gets the type of service, either RESOURCE_PROVIDER or TOOL_INVOKER.
      Returns:
      The type of service.
    • toAddress

      public String toAddress()
      Returns a string representation of the service address in the format "host:port".
      Returns:
      A string representation of the service address.
    • provider

      public static ServiceTarget provider(String service, String address, int port)
      Creates a new instance of ServiceTarget with the specified parameters and a service type of RESOURCE_PROVIDER.
      Parameters:
      service - The name of the service.
      address - The host address of the service.
      port - The port number of the service.
      Returns:
      A new instance of ServiceTarget.
    • toolInvoker

      public static ServiceTarget toolInvoker(String service, String address, int port)
      Creates a new instance of ServiceTarget with the specified parameters and a service type of TOOL_INVOKER.
      Parameters:
      service - The name of the service.
      address - The host address of the service.
      port - The port number of the service.
      Returns:
      A new instance of ServiceTarget.