Class AbstractToolProvider

java.lang.Object
org.frankframework.mcp.AbstractToolProvider
All Implemented Interfaces:
McpToolProvider
Direct Known Subclasses:
AdapterToolProvider, ClusterMemberToolProvider, ConfigurationToolProvider, LoggingToolProvider, MessageBrowserToolProvider, ServerInfoToolProvider, TestPipelineToolProvider

public abstract class AbstractToolProvider extends Object implements McpToolProvider
Base class for McpToolProviders. It talks to the (possibly remote) Frank!Framework Management Gateway, in the same way the Frank!Console's FrankApiService does, and offers small helpers to declare tools, read their arguments and turn a result (or exception) into an MCP McpSchema.CallToolResult, so that concrete providers only need to describe the gateway request.
  • Field Details

    • log

      protected final org.apache.logging.log4j.Logger log
    • outboundGateway

      protected final OutboundGateway outboundGateway
    • session

      protected final McpSession session
  • Constructor Details

  • Method Details

    • sendSync

      protected @NonNull org.springframework.messaging.Message<?> sendSync(RequestMessageBuilder builder)
      Send a request and wait for the response.
      Returns:
      the response message, never null
    • sendSyncForString

      protected @NonNull String sendSyncForString(RequestMessageBuilder builder)
      Send a request, wait for the response and return its payload as a String.
      Returns:
      the response payload, or an empty String when the response has no content
    • sendAsync

      protected void sendAsync(RequestMessageBuilder builder)
      Send a request without waiting for (or expecting) a response.
    • getMembers

      protected @NonNull List<OutboundGateway.ClusterMember> getMembers()
      All members that are part of the (Hazelcast) cluster. Empty when the gateway does not support clustering.
    • tool

      protected io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification tool(String name, String description, Map<String,Object> inputSchema, AbstractToolProvider.ToolCall call)
      Declare a tool.
      Parameters:
      name - the unique tool name, as exposed to the MCP client
      description - a human/LLM readable description of what the tool does
      inputSchema - a JSON-schema describing the tool arguments (see ToolSchema)
      call - the logic that is invoked when the tool is called
    • stringArg

      protected static @Nullable String stringArg(io.modelcontextprotocol.spec.McpSchema.CallToolRequest request, String name)
    • requiredStringArg

      protected static String requiredStringArg(io.modelcontextprotocol.spec.McpSchema.CallToolRequest request, String name)
    • booleanArg

      protected static boolean booleanArg(io.modelcontextprotocol.spec.McpSchema.CallToolRequest request, String name)
    • integerArg

      protected static @Nullable Integer integerArg(io.modelcontextprotocol.spec.McpSchema.CallToolRequest request, String name)