Class JsonSchema

java.lang.Object
org.apache.juneau.bean.mcp.v20250618.JsonSchema

@Marshalled public class JsonSchema extends Object
JSON Schema subset used by MCP tool inputSchema objects.
  • Constructor Details

  • Method Details

    • getType

      public String getType()
      Schema type keyword (for example object).
      Returns:
      The type, or null if not set.
    • setType

      public JsonSchema setType(String value)
      Sets the schema type keyword.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getProperties

      Object property schemas.
      Returns:
      The properties map, or null if not set.
    • setProperties

      Sets object property schemas.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • addProperty

      public JsonSchema addProperty(String name, JsonSchema value)
      Convenience method to add a single property schema.
      Parameters:
      name - The property name. Can be null (LinkedHashMap tolerates a null key).
      value - The property schema. Can be null (stored as null).
      Returns:
      This object (for method chaining).
    • getRequired

      public List<String> getRequired()
      Required property names.
      Returns:
      The required list, or null if not set.
    • setRequired

      public JsonSchema setRequired(List<String> value)
      Sets required property names.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • setRequired

      public JsonSchema setRequired(String... value)
      Sets required property names.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • addRequired

      public JsonSchema addRequired(String... value)
      Appends to the required property names.
      Parameters:
      value - The values to append.
      Returns:
      This object (for method chaining).
    • addRequired

      Appends to the required property names.
      Parameters:
      value - The values to append.
      Returns:
      This object (for method chaining).
    • getAdditionalProperties

      additionalProperties keyword (boolean or nested schema).
      Returns:
      The value, or null if not set.
    • setAdditionalProperties

      Sets additionalProperties.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getItems

      public JsonSchema getItems()
      Array items schema.
      Returns:
      The items schema, or null if not set.
    • setItems

      public JsonSchema setItems(JsonSchema value)
      Sets array items schema.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getDefs

      $defs map for reusable sub-schemas.
      Returns:
      The defs map, or null if not set.
    • setDefs

      Sets $defs.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • addDef

      public JsonSchema addDef(String name, JsonSchema value)
      Convenience method to add a single reusable sub-schema.
      Parameters:
      name - The sub-schema name. Can be null (LinkedHashMap tolerates a null key).
      value - The sub-schema. Can be null (stored as null).
      Returns:
      This object (for method chaining).