Class DefaultMcpResourcesAsToolsPresenter

java.lang.Object
dev.langchain4j.mcp.resourcesastools.DefaultMcpResourcesAsToolsPresenter
All Implemented Interfaces:
McpResourcesAsToolsPresenter

public class DefaultMcpResourcesAsToolsPresenter extends Object implements McpResourcesAsToolsPresenter
Default implementation of McpResourcesAsToolsPresenter. A presenter that presents MCP resources as tools. It provides two tools: list_resources and get_resource. The list_resources tool lists all available resources. It doesn't take any arguments and returns a JSON array where each object represents a single resource. For example:
 [ {
   "mcpServer" : "alice",
   "uri" : "file:///info",
   "uriTemplate" : null,
   "name" : "basicInfo",
   "description" : "Basic information about Alice",
   "mimeType" : "text/plain"
 }, {
   "mcpServer" : "bob",
   "uri" : "file:///info",
   "uriTemplate" : null,
   "name" : "basicInfo",
   "description" : "Basic information about Bob",
   "mimeType" : "text/plain"
 } ]
 
The get_resource tool retrieves a specific resource based on its MCP server name and URI. It takes two arguments: mcpServer and uri. Both arguments are mandatory. For example: The DefaultMcpResourcesAsToolsPresenter provides default names and descriptions of these two tools and their arguments. These descriptions should generally work, but if it's necessary to override them, this can be done in the builder.