Package com.tnsai.agents.validation
Record Class ValidationContext
java.lang.Object
java.lang.Record
com.tnsai.agents.validation.ValidationContext
- Record Components:
llmClient- agent-level LLM, if any was set on the builderroles- roles registered on the builderhasExternalTools-truewhen at least one external tool (toolPojos / dynamicTools / builtInTools) is registered on the builder — the agent will expose tools to the LLM at chat timememoryStore- agent-level memory store, if explicitly set on the builder (the InMemoryStore default applied bybuild()after validation is intentionally NOT surfaced here)reachabilityTimeout- per-probe wall-clock budget forReachabilityValidators; ignored by sync validatorshasConfirmationRequiredTool-truewhen at least one@Toolmethod on a registered tool POJO hasrequiresConfirmation = true(issue #234 — AGENT-V006)toolCallFilterSet-truewhen the builder has aToolCallFilterconfigured viaAgentBuilder.toolCallFilter(...)(issue #234 — AGENT-V006)tenantId- agent-level tenant identifier configured viaAgentBuilder.tenantId(...); empty when no tenant scope is declared (issue #235 phase 1).AGENT-V012(TenantScopeValidator) reads this fieldmcpServerUrls- unique MCP server URLs collected from everyMCP_TOOLaction across all roles — consumed byMCPServerReachabilityValidator(AGENT-V011, issue #237). Empty set when no role declares any MCP-tool action
public record ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout, boolean hasConfirmationRequiredTool, boolean toolCallFilterSet, Optional<String> tenantId, Set<String> mcpServerUrls)
extends Record
Read-only snapshot of an
AgentBuilder state passed to each
Validator. Keeps validators decoupled from AgentBuilder
mutation surface — validators see a frozen view and cannot accidentally
mutate or trigger side effects on the builder.
The tools list field was dropped in v0.6.0 — no remaining
validator consumes it after the function-shape POJO migration. Tool
uniqueness is now enforced by ToolMethodRegistry at registration
time (see AgentBuilder.toolPojos). The lighter
hasExternalTools boolean was reintroduced in 0.8.4 (issue #85
phase 1) so LLMCapabilityValidator can detect when the agent
will pass tools to the LLM at runtime — without exposing the full POJO
graph to validators that don't need it.
- Since:
- 0.5.0 (issue #85);
hasExternalToolssince 0.8.4 (phase 1);reachabilityTimeoutsince 0.8.4 (phase 2a);memoryStoresince 0.8.4 (phase 2b);hasConfirmationRequiredTool/toolCallFilterSetsince 0.8.5 (issue #234);tenantIdsince 0.8.5 (issue #235 phase 1);mcpServerUrlssince 0.8.6 (issue #237)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationDefault per-probe timeout used when callers don't supply one. -
Constructor Summary
ConstructorsConstructorDescriptionValidationContext(Optional<LLMClient> llmClient, List<Role> roles) Backwards-compatible 2-arg constructor — defaults every later-added field to its safe / empty value so existing validator test fixtures keep compiling.ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools) 3-arg constructor — defaultsmemoryStore,reachabilityTimeout, the V006 tool/filter flags,tenantId, andmcpServerUrls.ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Duration reachabilityTimeout) 4-arg constructor — defaultsmemoryStore, the V006 tool/filter flags,tenantId, andmcpServerUrls.ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout) 5-arg constructor (the pre-0.8.5 primary shape) — defaults the V006 tool/filter flags,tenantId, andmcpServerUrlsso existing call sites keep compiling.ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout, boolean hasConfirmationRequiredTool, boolean toolCallFilterSet) 7-arg constructor (the V006 shape) — defaultstenantIdandmcpServerUrlsso call sites added by issue #234 keep compiling.ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout, boolean hasConfirmationRequiredTool, boolean toolCallFilterSet, Optional<String> tenantId) 8-arg constructor (the V012 shape) — defaultsmcpServerUrlsso call sites added by issue #235 phase 2 keep compiling.ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout, boolean hasConfirmationRequiredTool, boolean toolCallFilterSet, Optional<String> tenantId, Set<String> mcpServerUrls) Creates an instance of aValidationContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of thehasConfirmationRequiredToolrecord component.booleanReturns the value of thehasExternalToolsrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thellmClientrecord component.Returns the value of themcpServerUrlsrecord component.Returns the value of thememoryStorerecord component.Returns the value of thereachabilityTimeoutrecord component.roles()Returns the value of therolesrecord component.tenantId()Returns the value of thetenantIdrecord component.booleanReturns the value of thetoolCallFilterSetrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_REACHABILITY_TIMEOUT
Default per-probe timeout used when callers don't supply one.
-
-
Constructor Details
-
ValidationContext
public ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout, boolean hasConfirmationRequiredTool, boolean toolCallFilterSet, Optional<String> tenantId, Set<String> mcpServerUrls) Creates an instance of aValidationContextrecord class.- Parameters:
llmClient- the value for thellmClientrecord componentroles- the value for therolesrecord componenthasExternalTools- the value for thehasExternalToolsrecord componentmemoryStore- the value for thememoryStorerecord componentreachabilityTimeout- the value for thereachabilityTimeoutrecord componenthasConfirmationRequiredTool- the value for thehasConfirmationRequiredToolrecord componenttoolCallFilterSet- the value for thetoolCallFilterSetrecord componenttenantId- the value for thetenantIdrecord componentmcpServerUrls- the value for themcpServerUrlsrecord component
-
ValidationContext
Backwards-compatible 2-arg constructor — defaults every later-added field to its safe / empty value so existing validator test fixtures keep compiling. -
ValidationContext
3-arg constructor — defaultsmemoryStore,reachabilityTimeout, the V006 tool/filter flags,tenantId, andmcpServerUrls. -
ValidationContext
public ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Duration reachabilityTimeout) 4-arg constructor — defaultsmemoryStore, the V006 tool/filter flags,tenantId, andmcpServerUrls. -
ValidationContext
public ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout) 5-arg constructor (the pre-0.8.5 primary shape) — defaults the V006 tool/filter flags,tenantId, andmcpServerUrlsso existing call sites keep compiling. -
ValidationContext
public ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout, boolean hasConfirmationRequiredTool, boolean toolCallFilterSet) 7-arg constructor (the V006 shape) — defaultstenantIdandmcpServerUrlsso call sites added by issue #234 keep compiling. -
ValidationContext
public ValidationContext(Optional<LLMClient> llmClient, List<Role> roles, boolean hasExternalTools, Optional<MemoryStore> memoryStore, Duration reachabilityTimeout, boolean hasConfirmationRequiredTool, boolean toolCallFilterSet, Optional<String> tenantId) 8-arg constructor (the V012 shape) — defaultsmcpServerUrlsso call sites added by issue #235 phase 2 keep compiling.
-
-
Method Details
-
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 '=='. -
llmClient
Returns the value of thellmClientrecord component.- Returns:
- the value of the
llmClientrecord component
-
roles
Returns the value of therolesrecord component.- Returns:
- the value of the
rolesrecord component
-
hasExternalTools
public boolean hasExternalTools()Returns the value of thehasExternalToolsrecord component.- Returns:
- the value of the
hasExternalToolsrecord component
-
memoryStore
Returns the value of thememoryStorerecord component.- Returns:
- the value of the
memoryStorerecord component
-
reachabilityTimeout
Returns the value of thereachabilityTimeoutrecord component.- Returns:
- the value of the
reachabilityTimeoutrecord component
-
hasConfirmationRequiredTool
public boolean hasConfirmationRequiredTool()Returns the value of thehasConfirmationRequiredToolrecord component.- Returns:
- the value of the
hasConfirmationRequiredToolrecord component
-
toolCallFilterSet
public boolean toolCallFilterSet()Returns the value of thetoolCallFilterSetrecord component.- Returns:
- the value of the
toolCallFilterSetrecord component
-
tenantId
Returns the value of thetenantIdrecord component.- Returns:
- the value of the
tenantIdrecord component
-
mcpServerUrls
Returns the value of themcpServerUrlsrecord component.- Returns:
- the value of the
mcpServerUrlsrecord component
-