Class SyncModernMcpResourceMethodCallback.Builder
java.lang.Object
org.springframework.ai.mcp.annotation.method.resource.AbstractMcpResourceMethodCallback.AbstractBuilder<SyncModernMcpResourceMethodCallback.Builder,SyncModernMcpResourceMethodCallback>
org.springframework.ai.mcp.annotation.method.resource.SyncModernMcpResourceMethodCallback.Builder
- Enclosing class:
- SyncModernMcpResourceMethodCallback
public static final class SyncModernMcpResourceMethodCallback.Builder
extends AbstractMcpResourceMethodCallback.AbstractBuilder<SyncModernMcpResourceMethodCallback.Builder,SyncModernMcpResourceMethodCallback>
Builder for
SyncModernMcpResourceMethodCallback instances.-
Field Summary
Fields inherited from class org.springframework.ai.mcp.annotation.method.resource.AbstractMcpResourceMethodCallback.AbstractBuilder
bean, contentType, description, meta, method, mimeType, name, resultConverter, uri, uriTemplateManagerFactory -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the callback.cacheScope(io.modelcontextprotocol.modern.McpSchema.CacheScope cacheScope) Sets thecacheScopecache hint applied when a legacy return value is converted.jsonMapper(@Nullable io.modelcontextprotocol.json.McpJsonMapper jsonMapper) Sets the mapper thatMcpModernSyncRequestContext.inputResponseconverts with, normally the server's.protected booleanWhether the callback built by this builder transmits the@McpResourcettlMs/cacheScopehints.ttlMs(long ttlMs) Sets thettlMscache hint applied when a legacy return value is converted.Methods inherited from class org.springframework.ai.mcp.annotation.method.resource.AbstractMcpResourceMethodCallback.AbstractBuilder
bean, contentType, description, method, mimeType, name, resource, resource, resultConverter, uri, uriTemplateManagerFactory, validate
-
Method Details
-
jsonMapper
public SyncModernMcpResourceMethodCallback.Builder jsonMapper(@Nullable io.modelcontextprotocol.json.McpJsonMapper jsonMapper) Sets the mapper thatMcpModernSyncRequestContext.inputResponseconverts with, normally the server's. Unset, the SDK default is used. -
supportsCacheHints
protected boolean supportsCacheHints()Description copied from class:AbstractMcpResourceMethodCallback.AbstractBuilderWhether the callback built by this builder transmits the@McpResourcettlMs/cacheScopehints. Only the 2026-07-28 ("modern") callback does; every other builder warns when the hints are set. -
ttlMs
Sets thettlMscache hint applied when a legacy return value is converted. Must not be negative;0(the default) means not cacheable. -
cacheScope
public SyncModernMcpResourceMethodCallback.Builder cacheScope(io.modelcontextprotocol.modern.McpSchema.CacheScope cacheScope) Sets thecacheScopecache hint applied when a legacy return value is converted. Defaults toMcpSchema.CacheScope.PRIVATE. -
build
Description copied from class:AbstractMcpResourceMethodCallback.AbstractBuilderBuild the callback.- Specified by:
buildin classAbstractMcpResourceMethodCallback.AbstractBuilder<SyncModernMcpResourceMethodCallback.Builder,SyncModernMcpResourceMethodCallback> - Returns:
- A new callback instance
-