Record Class ToolDefinition

java.lang.Object
java.lang.Record
dev.dokimos.core.agents.ToolDefinition
Record Components:
name - the tool name
description - the tool description
inputSchema - the JSON Schema for the tool's arguments

public record ToolDefinition(String name, String description, Map<String,Object> inputSchema) extends Record
Describes an available tool's contract including its name, description, and JSON schema.

Used by tool reliability evaluators to assess tool naming, description quality, and by tool validity evaluators to validate tool call arguments against schemas.

  • Constructor Details

    • ToolDefinition

      public ToolDefinition(String name, String description, Map<String,Object> inputSchema)
      Creates an instance of a ToolDefinition record class.
      Parameters:
      name - the value for the name record component
      description - the value for the description record component
      inputSchema - the value for the inputSchema record component
  • Method Details

    • of

      public static ToolDefinition of(String name, String description, Map<String,Object> inputSchema)
      Creates a tool definition with a name, description, and input schema.
      Parameters:
      name - the tool name
      description - the tool description
      inputSchema - the JSON Schema for arguments
      Returns:
      a new tool definition
    • fromMap

      public static ToolDefinition fromMap(Map<String,Object> map)
      Creates a tool definition from a map, typically when deserializing from a JSON dataset.

      Expected keys: "name", "description", "inputSchema".

      Parameters:
      map - the map to create from
      Returns:
      a new tool definition
    • requiredParameters

      public List<String> requiredParameters()
      Extracts required parameter names from the input schema.
      Returns:
      list of required parameter names, or empty list if none defined
    • parameterNames

      public Set<String> parameterNames()
      Extracts all parameter names from the input schema properties.
      Returns:
      set of parameter names, or empty set if none defined
    • parameterSchema

      public Map<String,Object> parameterSchema(String paramName)
      Gets the schema for a specific parameter.
      Parameters:
      paramName - the parameter name
      Returns:
      the parameter's schema map, or empty map if not found
    • builder

      public static ToolDefinition.Builder builder()
      Creates a new builder for constructing tool definitions.
      Returns:
      a new builder
    • 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.
    • name

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

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

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