Interface McpClientInstance

All Superinterfaces:
AgentInstance, InternalAgent

public interface McpClientInstance extends InternalAgent
Implemented by every MCP client agent, created with McpAgent or declared with the @McpClientAgent annotation: gives access to the MCP tool bound by the agent.
  • Method Details

    • inputKeys

      String[] inputKeys()
      The configured input keys of the agent, mandatory for an untyped agent, or null for a typed agent without explicit input keys, whose inputs are the parameters of its agent method. Never resolves the tool.
    • inputDescriptions

      default Map<String,String> inputDescriptions()
      Descriptions published by the MCP tool for each input key; resolves the tool if not yet done.
    • toolName

      String toolName()
      The name of the MCP tool bound by the agent: the configured one, else the name of the single tool of the MCP server, which is resolved at this point if not yet done.
    • toolDescription

      String toolDescription()
      The description of the MCP tool; resolves the tool if not yet done.
    • toolSpecification

      ToolSpecification toolSpecification()
      Returns the specification of the MCP tool bound by the agent, creating the MCP client and listing the tools of the server if not yet done. The tool is normally resolved on the first invocation of the agent, so this call blocks until the resolution completes, at most for the resolution timeout of the agent when one is set, and can be used to warm up the agent, or to fail fast, before its first invocation. Inside a declarative agentic system the MCP agent is wrapped: reach it through subagent.as(McpClientInstance.class) on the corresponding subagent of the AgentInstance of the system.
      Returns:
      the specification of the MCP tool bound by the agent
      Throws:
      McpToolResolutionException - if the client cannot be created or the tools cannot be listed, or if this takes longer than the resolution timeout
      AgenticSystemConfigurationException - if the tool is not found, if no tool name is configured and the server exposes more than one tool, or if the client supplier does not return an MCP client
      Since:
      1.24.0