Package ai.wanaku.core.mcp.providers
Class ServiceTarget
java.lang.Object
ai.wanaku.core.mcp.providers.ServiceTarget
Represents a target service endpoint that can be either a resource provider or a tool invoker.
-
Constructor Summary
ConstructorsConstructorDescriptionServiceTarget(String service, String host, int port, ServiceType serviceType) Constructs a new instance ofServiceTarget. -
Method Summary
Modifier and TypeMethodDescriptiongetHost()Gets the host address of the service.intgetPort()Gets the port number of the service.Gets the name of the service.Gets the type of service, either RESOURCE_PROVIDER or TOOL_INVOKER.static ServiceTargetCreates a new instance ofServiceTargetwith the specified parameters and a service type of RESOURCE_PROVIDER.Returns a string representation of the service address in the format "host:port".static ServiceTargettoolInvoker(String service, String address, int port) Creates a new instance ofServiceTargetwith the specified parameters and a service type of TOOL_INVOKER.
-
Constructor Details
-
ServiceTarget
Constructs a new instance ofServiceTarget.- 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
Gets the name of the service.- Returns:
- The name of the service.
-
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
Gets the type of service, either RESOURCE_PROVIDER or TOOL_INVOKER.- Returns:
- The type of service.
-
toAddress
Returns a string representation of the service address in the format "host:port".- Returns:
- A string representation of the service address.
-
provider
Creates a new instance ofServiceTargetwith 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
Creates a new instance ofServiceTargetwith 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.
-