Package org.mcpjava.server.resources
Interface ResourceResponse
- All Superinterfaces:
MetaCarrier
The result of a
resources/read request.
Returning a ResourceResponse from a Resource or
ResourceTemplate-annotated method gives more control over the response that's
returned to the client.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for creating resource read responses. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceResponse.Builderbuilder()Create a builder for aResourceResponseThe resource contents.static ResourceResponseCreates a newResourceResponsewith binary content and no MIME typestatic ResourceResponseCreates a newResourceResponsewith binary content and MIME typestatic ResourceResponseCreates a newResourceResponsewith text content and no MIME typestatic ResourceResponseCreates a newResourceResponsewith text content and MIME typeMethods inherited from interface org.mcpjava.server.MetaCarrier
metadata
-
Method Details
-
getContents
List<ResourceContents> getContents()The resource contents. Usually a response will contain a single content object.- Returns:
- the list of resource contents
-
builder
Create a builder for aResourceResponse- Returns:
- the new
ResourceResponsebuilder
-
of
Creates a newResourceResponsewith text content and no MIME type- Parameters:
uri- the resource URItext- the text content- Returns:
- the new resource response
-
of
Creates a newResourceResponsewith text content and MIME type- Parameters:
uri- the resource URItext- the text contentmimeType- the MIME type- Returns:
- the new resource response
-
of
Creates a newResourceResponsewith binary content and no MIME type- Parameters:
uri- the resource URIdata- the binary content- Returns:
- the new resource response
-
of
Creates a newResourceResponsewith binary content and MIME type- Parameters:
uri- the resource URIdata- the binary contentmimeType- the MIME type- Returns:
- the new resource response
-