Class DefaultMcpClientBuilder<T>
java.lang.Object
dev.langchain4j.agentic.mcp.DefaultMcpClientBuilder<T>
- All Implemented Interfaces:
InternalAgent, McpClientBuilder<T>, AgentInstance, InvocationHandler
public class DefaultMcpClientBuilder<T>
extends Object
implements McpClientBuilder<T>, InternalAgent, InvocationHandler
-
Method Summary
Modifier and TypeMethodDescriptionThe condition under which this agent runs when it is invoked as a subagent, ornullwhen it always runs.activationCondition(String description, Predicate<AgenticScope> activationCondition) Sets the condition, with its description, under which the agent runs when it is invoked as a subagent of an agentic system.agentId()voidbooleanasync()async(boolean async) build()listener()listener(AgentListener agentListener) name()parent()voidregisterInheritedParentListener(AgentListener parentListener) voidsetParent(InternalAgent parent) topology()Class<?> type()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AgentInstance
as, leaf, optionalMethods inherited from interface InternalAgent
allowChatMemory, allowStreamingOutput, compensateOnError, enableCrossAgentCompensation, setAgentIdMethods inherited from interface McpClientBuilder
activationCondition
-
Method Details
-
toolName
- Specified by:
toolNamein interfaceMcpClientBuilder<T>
-
inputKeys
- Specified by:
inputKeysin interfaceMcpClientBuilder<T>
-
outputKey
- Specified by:
outputKeyin interfaceMcpClientBuilder<T>
-
async
- Specified by:
asyncin interfaceMcpClientBuilder<T>
-
listener
- Specified by:
listenerin interfaceMcpClientBuilder<T>
-
activationCondition
public McpClientBuilder<T> activationCondition(String description, Predicate<AgenticScope> activationCondition) Description copied from interface:McpClientBuilderSets the condition, with its description, under which the agent runs when it is invoked as a subagent of an agentic system. When the condition is false the MCP tool is not called and the agent is skipped. It can be evaluated more than once, so it must be free of side effects.- Specified by:
activationConditionin interfaceMcpClientBuilder<T>
-
build
- Specified by:
buildin interfaceMcpClientBuilder<T>
-
invoke
-
setParent
- Specified by:
setParentin interfaceInternalAgent
-
registerInheritedParentListener
- Specified by:
registerInheritedParentListenerin interfaceInternalAgent
-
appendId
- Specified by:
appendIdin interfaceInternalAgent
-
listener
- Specified by:
listenerin interfaceInternalAgent
-
type
- Specified by:
typein interfaceAgentInstance
-
plannerType
- Specified by:
plannerTypein interfaceAgentInstance
-
name
- Specified by:
namein interfaceAgentInstance
-
agentId
- Specified by:
agentIdin interfaceAgentInstance
-
description
- Specified by:
descriptionin interfaceAgentInstance
-
outputType
- Specified by:
outputTypein interfaceAgentInstance
-
outputKey
- Specified by:
outputKeyin interfaceAgentInstance
-
async
public boolean async()- Specified by:
asyncin interfaceAgentInstance
-
activationCondition
Description copied from interface:AgentInstanceThe condition under which this agent runs when it is invoked as a subagent, ornullwhen it always runs. When the condition is false, the agent is skipped: it is not invoked, it writes nothing to theAgenticScopeand its parent's planner is notified of the skip. The condition is ignored when the agent is invoked directly, as the root of an agentic system.The condition can be evaluated more than once for a single invocation, by the planner of the parent while selecting its next agents and again when the agent is invoked, so it must be cheap and free of side effects.
- Specified by:
activationConditionin interfaceAgentInstance
-
arguments
- Specified by:
argumentsin interfaceAgentInstance
-
parent
- Specified by:
parentin interfaceAgentInstance
-
subagents
- Specified by:
subagentsin interfaceAgentInstance
-
topology
- Specified by:
topologyin interfaceAgentInstance
-