Package akka.javasdk.agent
Interface RemoteMcpTools.ToolInterceptor
- Enclosing interface:
RemoteMcpTools
public static interface RemoteMcpTools.ToolInterceptor
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
interceptRequest
(RemoteMcpTools.ToolInterceptorContext context, String requestPayloadJson) Intercept calls to tools before they are executed, disallowing the call based on the payload can be done by throwing an exception, modifying the payload is also possible.default String
interceptResponse
(RemoteMcpTools.ToolInterceptorContext context, String requestPayloadJson, String responsePayload) Intercept responses from MCP tools, disallowing the call based on the result can be done by throwing an exception, modifying the result is also possible.
-
Method Details
-
interceptRequest
default String interceptRequest(RemoteMcpTools.ToolInterceptorContext context, String requestPayloadJson) Intercept calls to tools before they are executed, disallowing the call based on the payload can be done by throwing an exception, modifying the payload is also possible. When modifying the payload, you need to make sure the payload still fulfills the schema of the tool with required fields and correct field types.- Parameters:
context
- Details about the intercepted tool callrequestPayloadJson
- The tool request payload in a Json string.
-
interceptResponse
default String interceptResponse(RemoteMcpTools.ToolInterceptorContext context, String requestPayloadJson, String responsePayload) Intercept responses from MCP tools, disallowing the call based on the result can be done by throwing an exception, modifying the result is also possible. When modifying the result, you need to make sure the payload still is something the model will understand.- Parameters:
context
- Details about the intercepted tool callrequestPayloadJson
- The request payload as passed to the MCP tool (possibly modified byinterceptRequest(ToolInterceptorContext, String)
)
-