Class DefaultMcpClient

java.lang.Object
dev.langchain4j.mcp.client.DefaultMcpClient
All Implemented Interfaces:
McpClient, AutoCloseable

public class DefaultMcpClient extends Object implements McpClient
  • Constructor Details

  • Method Details

    • listTools

      public List<dev.langchain4j.agent.tool.ToolSpecification> listTools()
      Description copied from interface: McpClient
      Obtains a list of tools from the MCP server.
      Specified by:
      listTools in interface McpClient
    • executeTool

      public String executeTool(dev.langchain4j.agent.tool.ToolExecutionRequest executionRequest)
      Description copied from interface: McpClient
      Executes a tool on the MCP server and returns the result as a String. Currently, this expects a tool execution to only contain text-based results.
      Specified by:
      executeTool in interface McpClient
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable