Module agentforge4j.tools.http
Package com.agentforge4j.tools.http
Record Class HttpEndpointDefinition
java.lang.Object
java.lang.Record
com.agentforge4j.tools.http.HttpEndpointDefinition
- Record Components:
capability-<domain>.<verb_object>logical id, lowercase snake_case; stable and unique within the provider, and used as theremoteToolNamedisplayName- human-readable name, ornulldescription- human-readable description, ornullmutating- whether invoking this endpoint may mutate remote state; surfaced as the realisedToolRiskMetadatasignal. Nevernullon a constructed instance:nullis accepted only as the wire/positional-constructor spelling of "absent" (an HTTP_TOOL integration JSON config that omits the field, or a direct positional-constructor caller passingnull) and is normalized totrue— the highest safe risk — before the object exists, so a definition that omits the signal is treated as conservative. Java callers should preferHttpEndpointDefinition.Builder.withMutating(boolean), which takes a non-null primitive and cannot express "absent" at allmethod- HTTP methodurlTemplate- absolutehttp/httpsURL with{name}placeholdersinputSchema- JSON Schema for the arguments; non-null (conventionadditionalProperties:false)outputSchema- JSON Schema for the result, ornullif unknownqueryArgs- argument names routed to the query stringbodyMode- how the request body is formed from the leftover argumentsstaticHeaders- fixed, non-secret headers (Content-Type, Accept, API-version, ...)secretHeaders- header name to secret-reference key; resolved at invoke, never inlinedtimeout- endpoint-level timeout ceiling, ornull; restricts, never expandsmaxRetries- endpoint-level retry cap, ornullwhen unset; restricts, never expandsretryNonIdempotent- opt-in to retryPOST/PATCH; meaningless on other methodsmaxResponseBytes- response body read cap, ornullto use the provider default
public record HttpEndpointDefinition(String capability, String displayName, String description, Boolean mutating, HttpMethod method, String urlTemplate, com.fasterxml.jackson.databind.JsonNode inputSchema, com.fasterxml.jackson.databind.JsonNode outputSchema, Set<String> queryArgs, BodyMode bodyMode, Map<String,String> staticHeaders, Map<String,String> secretHeaders, Duration timeout, Integer maxRetries, boolean retryNonIdempotent, Long maxResponseBytes)
extends Record
Code-defined binding of a logical tool capability to a single HTTP endpoint.
Immutable; supplied by the consumer to HttpToolProvider. Per-field invariants are
checked here at construction; cross-field rules that need the provider's view (capability
uniqueness, argument disposition, method/body legality, secret-header consistency) are enforced
by HttpToolProvider's constructor so a bad set of definitions fails fast at wiring time.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionHttpEndpointDefinition(String capability, String displayName, String description, Boolean mutating, HttpMethod method, String urlTemplate, com.fasterxml.jackson.databind.JsonNode inputSchema, com.fasterxml.jackson.databind.JsonNode outputSchema, Set<String> queryArgs, BodyMode bodyMode, Map<String, String> staticHeaders, Map<String, String> secretHeaders, Duration timeout, Integer maxRetries, boolean retryNonIdempotent, Long maxResponseBytes) Validates per-field invariants and defensively copies the collections. -
Method Summary
Modifier and TypeMethodDescriptionbodyMode()Returns the value of thebodyModerecord component.builder()Returns a newHttpEndpointDefinition.Builderfor assembling anHttpEndpointDefinitionwithout 16 positional constructor arguments.Returns the value of thecapabilityrecord component.Returns the value of thedescriptionrecord component.Returns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.com.fasterxml.jackson.databind.JsonNodeReturns the value of theinputSchemarecord component.Returns the value of themaxResponseBytesrecord component.Returns the value of themaxRetriesrecord component.method()Returns the value of themethodrecord component.mutating()Returns the value of themutatingrecord component.com.fasterxml.jackson.databind.JsonNodeReturns the value of theoutputSchemarecord component.Returns the value of thequeryArgsrecord component.booleanReturns the value of theretryNonIdempotentrecord component.Returns the value of thesecretHeadersrecord component.Returns the value of thestaticHeadersrecord component.timeout()Returns the value of thetimeoutrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theurlTemplaterecord component.
-
Constructor Details
-
HttpEndpointDefinition
public HttpEndpointDefinition(String capability, String displayName, String description, Boolean mutating, HttpMethod method, String urlTemplate, com.fasterxml.jackson.databind.JsonNode inputSchema, com.fasterxml.jackson.databind.JsonNode outputSchema, Set<String> queryArgs, BodyMode bodyMode, Map<String, String> staticHeaders, Map<String, String> secretHeaders, Duration timeout, Integer maxRetries, boolean retryNonIdempotent, Long maxResponseBytes) Validates per-field invariants and defensively copies the collections.
-
-
Method Details
-
builder
Returns a newHttpEndpointDefinition.Builderfor assembling anHttpEndpointDefinitionwithout 16 positional constructor arguments. The required fields (capability,method,urlTemplate,inputSchema,bodyMode) are validated whenHttpEndpointDefinition.Builder.build()delegates to the canonical constructor; every other field may be left unset and takes the same default the canonical constructor already applies to anullargument.- Returns:
- new builder; never
null
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
capability
Returns the value of thecapabilityrecord component.- Returns:
- the value of the
capabilityrecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
mutating
Returns the value of themutatingrecord component.- Returns:
- the value of the
mutatingrecord component
-
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
urlTemplate
Returns the value of theurlTemplaterecord component.- Returns:
- the value of the
urlTemplaterecord component
-
inputSchema
public com.fasterxml.jackson.databind.JsonNode inputSchema()Returns the value of theinputSchemarecord component.- Returns:
- the value of the
inputSchemarecord component
-
outputSchema
public com.fasterxml.jackson.databind.JsonNode outputSchema()Returns the value of theoutputSchemarecord component.- Returns:
- the value of the
outputSchemarecord component
-
queryArgs
Returns the value of thequeryArgsrecord component.- Returns:
- the value of the
queryArgsrecord component
-
bodyMode
Returns the value of thebodyModerecord component.- Returns:
- the value of the
bodyModerecord component
-
staticHeaders
Returns the value of thestaticHeadersrecord component.- Returns:
- the value of the
staticHeadersrecord component
-
secretHeaders
Returns the value of thesecretHeadersrecord component.- Returns:
- the value of the
secretHeadersrecord component
-
timeout
Returns the value of thetimeoutrecord component.- Returns:
- the value of the
timeoutrecord component
-
maxRetries
Returns the value of themaxRetriesrecord component.- Returns:
- the value of the
maxRetriesrecord component
-
retryNonIdempotent
public boolean retryNonIdempotent()Returns the value of theretryNonIdempotentrecord component.- Returns:
- the value of the
retryNonIdempotentrecord component
-
maxResponseBytes
Returns the value of themaxResponseBytesrecord component.- Returns:
- the value of the
maxResponseBytesrecord component
-