Class McpUtils
java.lang.Object
com.mulesoft.connectors.mcp.internal.McpUtils
Misc utilities
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]fromBase64(String base64) Decodes the base64 content as a byte arrayfromMcpRoles(List<io.modelcontextprotocol.spec.McpSchema.Role> roles) Transforms theMcpSchemarepresentation of a role into the connector onestatic RequestAttributesgetRequestAttributes(MessagingManager tracker) static <K,V> org.mule.runtime.api.util.MultiMap<K, V> immutable(org.mule.runtime.api.util.MultiMap<K, V> multiMap) static URIparseAndValidate(String uri) Parses the givenuriand throws aModuleExceptionif invalidstatic io.modelcontextprotocol.spec.McpSchema.JSONRPCResponserpcErrorResponse(io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage originalMessage, McpErrorTypes errorType, String message) static io.modelcontextprotocol.spec.McpSchema.JSONRPCResponserpcErrorResponse(Object id, McpErrorTypes errorType, String message) static StringtoBase64(InputStream inputStream) static List<io.modelcontextprotocol.spec.McpSchema.Role>toMcpRoles(List<Role> roles) Transforms the connector representation of roles into theMcpSchemaones
-
Method Details
-
parseAndValidate
Parses the givenuriand throws aModuleExceptionif invalid- Parameters:
uri- potentially a URI in String format- Returns:
- a parsed
URI
-
toMcpRoles
Transforms the connector representation of roles into theMcpSchemaones- Parameters:
roles- a list of roles- Returns:
- a list of
McpSchema.Roleroles
-
fromMcpRoles
Transforms theMcpSchemarepresentation of a role into the connector one- Parameters:
roles- a list of roles- Returns:
- a list of
Role
-
toBase64
- Parameters:
inputStream- a binary content- Returns:
- Base64 encoded content
-
fromBase64
Decodes the base64 content as a byte array- Parameters:
base64- encoded content- Returns:
- a byte array
-
getRequestAttributes
-
rpcErrorResponse
public static io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse rpcErrorResponse(io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage originalMessage, McpErrorTypes errorType, String message) -
rpcErrorResponse
public static io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse rpcErrorResponse(Object id, McpErrorTypes errorType, String message) -
immutable
public static <K,V> org.mule.runtime.api.util.MultiMap<K,V> immutable(org.mule.runtime.api.util.MultiMap<K, V> multiMap)
-