Package dev.enola.ai.mcp
Class McpLoader
java.lang.Object
dev.enola.ai.mcp.McpLoader
- All Implemented Interfaces:
NamedTypedObjectProvider<io.modelcontextprotocol.client.McpSyncClient>
public class McpLoader
extends Object
implements NamedTypedObjectProvider<io.modelcontextprotocol.client.McpSyncClient>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.modelcontextprotocol.spec.McpSchema.CallToolResultvoidload(ReadableResource resource) names()List available MCP tool names.Optional<io.modelcontextprotocol.client.McpSyncClient> Get an (optional) MCP tool by name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.enola.common.name.NamedTypedObjectProvider
get
-
Constructor Details
-
McpLoader
-
-
Method Details
-
load
- Throws:
IOException
-
names
List available MCP tool names.- Specified by:
namesin interfaceNamedTypedObjectProvider<io.modelcontextprotocol.client.McpSyncClient>
-
opt
Get an (optional) MCP tool by name.Note that it's possible that this returns
Optional.empty()for a name returned bynames()in case the tool failed to load, including due to a missing secret.- Specified by:
optin interfaceNamedTypedObjectProvider<io.modelcontextprotocol.client.McpSyncClient>
-
call
public io.modelcontextprotocol.spec.McpSchema.CallToolResult call(Object context, String server, String tool, String argumentsAsJson) throws IOException - Throws:
IOException
-