Record Class ChenilePolymorphVariant

java.lang.Object
java.lang.Record
org.chenile.mcp.model.ChenilePolymorphVariant
Record Components:
nameSuffix - - name suffix for the variant. This will be appended to the tool name.
description - - description of the variant1. This must be sufficient to invoke the tool
parameterTypes - - types of each of the parameter. If a parameter does not have a type it must have schema
parameterSchemas - - in case a parameter is not of concrete type, the schema (useful for map parameters)- this is an alternative to parameter type
parameterDescriptions - - detailed description of each parameter if available.
fixedParameterValues - - This is the only allowed value for the parameter for this variant. See the example given

public record ChenilePolymorphVariant(String nameSuffix, String description, Map<String, tools.jackson.core.type.TypeReference<?>> parameterTypes, Map<String,String> parameterSchemas, Map<String,String> parameterDescriptions, Map<String,Object> fixedParameterValues) extends Record
Describes each polymorph variant for a given operation in a given service.
Let us say we have a service "foo" and an operation bar(String id, String type,Object payload)
The type parameter above can take values "abc" and "def"
If type == "abc" then the payload must be of type AbcPayload else it must be DefPayload
The PolymorphProvider must return two PolymorphVariants - let us call them "variant1" and "variant2"
"variant1" will have fixed value for type as "abc" and "variant2" will have fixed value for type as "def"
variant1 payload will have parameterType as "AbcPayload". variant2 payload will have parameterType as "DefPayload"
Alternately, it is possible that we can return a payload schema for variant1 instead of payload type.
Both schema and type are not allowed for the same parameter. This class guards against that.
  • Field Details

  • Constructor Details

  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • nameSuffix

      public String nameSuffix()
      Returns the value of the nameSuffix record component.
      Returns:
      the value of the nameSuffix record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • parameterTypes

      public Map<String, tools.jackson.core.type.TypeReference<?>> parameterTypes()
      Returns the value of the parameterTypes record component.
      Returns:
      the value of the parameterTypes record component
    • parameterSchemas

      public Map<String,String> parameterSchemas()
      Returns the value of the parameterSchemas record component.
      Returns:
      the value of the parameterSchemas record component
    • parameterDescriptions

      public Map<String,String> parameterDescriptions()
      Returns the value of the parameterDescriptions record component.
      Returns:
      the value of the parameterDescriptions record component
    • fixedParameterValues

      public Map<String,Object> fixedParameterValues()
      Returns the value of the fixedParameterValues record component.
      Returns:
      the value of the fixedParameterValues record component