Package dev.dokimos.core.agents
Record Class ToolDefinition
java.lang.Object
java.lang.Record
dev.dokimos.core.agents.ToolDefinition
- Record Components:
name- the tool namedescription- the tool descriptioninputSchema- 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing tool definitions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolDefinition.Builderbuilder()Creates a new builder for constructing tool definitions.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.static ToolDefinitionCreates a tool definition from a map, typically when deserializing from a JSON dataset.final inthashCode()Returns a hash code value for this object.Returns the value of theinputSchemarecord component.name()Returns the value of thenamerecord component.static ToolDefinitionCreates a tool definition with a name, description, and input schema.Extracts all parameter names from the input schema properties.parameterSchema(String paramName) Gets the schema for a specific parameter.Extracts required parameter names from the input schema.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ToolDefinition
Creates an instance of aToolDefinitionrecord class.- Parameters:
name- the value for thenamerecord componentdescription- the value for thedescriptionrecord componentinputSchema- the value for theinputSchemarecord component
-
-
Method Details
-
of
Creates a tool definition with a name, description, and input schema.- Parameters:
name- the tool namedescription- the tool descriptioninputSchema- the JSON Schema for arguments- Returns:
- a new tool definition
-
fromMap
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
Extracts required parameter names from the input schema.- Returns:
- list of required parameter names, or empty list if none defined
-
parameterNames
Extracts all parameter names from the input schema properties.- Returns:
- set of parameter names, or empty set if none defined
-
parameterSchema
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
Creates a new builder for constructing tool definitions.- Returns:
- a new builder
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
inputSchema
Returns the value of theinputSchemarecord component.- Returns:
- the value of the
inputSchemarecord component
-