Class McpServerToolListingHandlerConfiguration.McpStreamableServerSessionFactory
java.lang.Object
io.meeds.mcp.server.configuration.McpServerToolListingHandlerConfiguration.McpStreamableServerSessionFactory
- All Implemented Interfaces:
io.modelcontextprotocol.spec.McpStreamableServerSession.Factory
- Enclosing class:
McpServerToolListingHandlerConfiguration
public static class McpServerToolListingHandlerConfiguration.McpStreamableServerSessionFactory
extends Object
implements io.modelcontextprotocol.spec.McpStreamableServerSession.Factory
-
Constructor Summary
ConstructorsConstructorDescriptionMcpStreamableServerSessionFactory(io.modelcontextprotocol.spec.DefaultMcpStreamableServerSessionFactory sessionFactory, org.springframework.context.ApplicationContext appContext) Copies the SDK factory's handlers, replacing thetools/listone withtoolsListRequestHandler(). -
Method Summary
Modifier and TypeMethodDescriptionvoidDrops every cachedtools/listanswer.io.modelcontextprotocol.spec.McpStreamableServerSession.McpStreamableServerSessionInitstartSession(io.modelcontextprotocol.spec.McpSchema.InitializeRequest initializeRequest)
-
Constructor Details
-
McpStreamableServerSessionFactory
public McpStreamableServerSessionFactory(io.modelcontextprotocol.spec.DefaultMcpStreamableServerSessionFactory sessionFactory, org.springframework.context.ApplicationContext appContext) Copies the SDK factory's handlers, replacing thetools/listone withtoolsListRequestHandler().- Parameters:
sessionFactory- the SDK factory whose handlers are readappContext- the application context the MCP server and tool service beans are resolved from, lazily
-
-
Method Details
-
startSession
public io.modelcontextprotocol.spec.McpStreamableServerSession.McpStreamableServerSessionInit startSession(io.modelcontextprotocol.spec.McpSchema.InitializeRequest initializeRequest) - Specified by:
startSessionin interfaceio.modelcontextprotocol.spec.McpStreamableServerSession.Factory- Parameters:
initializeRequest- the client'sinitializerequest- Returns:
- a new session wired to the copied handlers, with the SDK's own answer to the initialize request
-
clearToolsCache
public void clearToolsCache()Drops every cachedtools/listanswer. Called through the tool update listener registered ingetMcpServerToolService(), so a tool definition change — a tool disabled, its approval requirement flipped — is visible on the very next listing rather than at restart. Not called when the MCP audience changes: the cache is keyed on scopes only, on the invariant documented intoolsListRequestHandler(), so an audience change alters who reaches the handler, never what it answers.
-