Interface McpReadResourceResultConverter
- All Known Implementing Classes:
DefaultMcpReadResourceResultConverter
public interface McpReadResourceResultConverter
Interface for converting method return values to
McpSchema.ReadResourceResult.
This interface defines a contract for converting various return types from resource
methods to a standardized McpSchema.ReadResourceResult format.
- Author:
- Christian Tzolov
-
Method Summary
Modifier and TypeMethodDescriptionio.modelcontextprotocol.spec.McpSchema.ReadResourceResultconvertToReadResourceResult(Object result, String requestUri, String mimeType, AbstractMcpResourceMethodCallback.ContentType contentType) Converts the method's return value to aMcpSchema.ReadResourceResult.
-
Method Details
-
convertToReadResourceResult
io.modelcontextprotocol.spec.McpSchema.ReadResourceResult convertToReadResourceResult(Object result, String requestUri, String mimeType, AbstractMcpResourceMethodCallback.ContentType contentType) Converts the method's return value to aMcpSchema.ReadResourceResult.This method handles various return types and converts them to a standardized
McpSchema.ReadResourceResultformat.- Parameters:
result- The method's return valuerequestUri- The original request URImimeType- The MIME type of the resourcecontentType- The content type of the resource- Returns:
- A
McpSchema.ReadResourceResultcontaining the appropriate resource contents - Throws:
IllegalArgumentException- if the return type is not supported
-