MCPClient

org.llm4s.mcp.MCPClient
trait MCPClient

MCP clients handle the communication with MCP servers to:

  • Establish protocol handshake and negotiate capabilities
  • Retrieve available tools from remote servers
  • Execute tools remotely and return results
  • Manage connection lifecycle

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def close(): Unit

Closes the MCP client connection and releases resources. Should be called when done with the client.

Closes the MCP client connection and releases resources. Should be called when done with the client.

Attributes

def getTools(): Either[String, Seq[ToolFunction[_, _]]]

Retrieves all available tools from the MCP server. Returns tools converted to the llm4s ToolFunction format.

Retrieves all available tools from the MCP server. Returns tools converted to the llm4s ToolFunction format.

Attributes

Returns

Sequence of tool functions available from this server

def initialize(): Either[String, Unit]

Initializes the MCP connection with handshake protocol. Must be called before other operations.

Initializes the MCP connection with handshake protocol. Must be called before other operations.

Attributes

Returns

Either error message or successful initialization