Uses of Class
org.springframework.ai.chat.model.ToolContext
Packages that use ToolContext
Package
Description
Core support for Model Context Protocol (MCP) integration in Spring AI.
Method callbacks and specifications for MCP elicitation (user input) requests.
Method callbacks and specifications for MCP progress reporting.
Support for MCP servers implementing the 2026-07-28 ("modern") specification revision,
built on the
io.modelcontextprotocol.modern server API of the MCP Java SDK.Client-side support for the MCP 2026-07-28 ("modern") protocol revision, built on the
MCP Java SDK's
io.modelcontextprotocol.modern.client package.Tools a model can call to read a session.
Tool Search Tool API: core interface and model types for dynamic tool discovery.
-
Uses of ToolContext in org.springframework.ai.mcp
Methods in org.springframework.ai.mcp with parameters of type ToolContextModifier and TypeMethodDescriptionAsyncMcpToolCallback.call(String toolCallInput, @Nullable ToolContext toolContext) SyncMcpToolCallback.call(String toolCallInput, @Nullable ToolContext toolContext) ToolContextToMcpMetaConverter.convert(ToolContext toolContext) Convert the givenToolContextto a Map<String, Object> as MCP tool call metadata.static Optional<io.modelcontextprotocol.server.McpSyncServerExchange>McpToolUtils.getMcpExchange(ToolContext toolContext) Retrieves the MCP exchange object from the provided tool context if it exists. -
Uses of ToolContext in org.springframework.ai.mcp.annotation.method.elicitation
Methods in org.springframework.ai.mcp.annotation.method.elicitation that return types with arguments of type ToolContextModifier and TypeMethodDescriptionBiFunction<io.modelcontextprotocol.modern.McpSchema.ElicitRequest,@Nullable ToolContext, reactor.core.publisher.Mono<io.modelcontextprotocol.modern.McpSchema.ElicitResult>> AsyncModernElicitationSpecification.elicitationHandler()Returns the value of theelicitationHandlerrecord component.BiFunction<io.modelcontextprotocol.modern.McpSchema.ElicitRequest,@Nullable ToolContext, io.modelcontextprotocol.modern.McpSchema.ElicitResult> SyncModernElicitationSpecification.elicitationHandler()Returns the value of theelicitationHandlerrecord component.Methods in org.springframework.ai.mcp.annotation.method.elicitation with parameters of type ToolContextModifier and TypeMethodDescriptionreactor.core.publisher.Mono<io.modelcontextprotocol.modern.McpSchema.ElicitResult>AsyncMcpElicitationMethodCallback.applyModern(io.modelcontextprotocol.modern.McpSchema.ElicitRequest request, @Nullable ToolContext toolContext) Apply the callback to the elicitation request of a modern client, for a tool call with the given tool context.io.modelcontextprotocol.modern.McpSchema.ElicitResultSyncMcpElicitationMethodCallback.applyModern(io.modelcontextprotocol.modern.McpSchema.ElicitRequest request, @Nullable ToolContext toolContext) Apply the callback to the elicitation request of a modern client, for a tool call with the given tool context.Constructor parameters in org.springframework.ai.mcp.annotation.method.elicitation with type arguments of type ToolContextModifierConstructorDescriptionAsyncModernElicitationSpecification(String[] clients, boolean form, boolean url, BiFunction<io.modelcontextprotocol.modern.McpSchema.ElicitRequest, @Nullable ToolContext, reactor.core.publisher.Mono<io.modelcontextprotocol.modern.McpSchema.ElicitResult>> elicitationHandler) Creates an instance of aAsyncModernElicitationSpecificationrecord class.SyncModernElicitationSpecification(String[] clients, boolean form, boolean url, BiFunction<io.modelcontextprotocol.modern.McpSchema.ElicitRequest, @Nullable ToolContext, io.modelcontextprotocol.modern.McpSchema.ElicitResult> elicitationHandler) Creates an instance of aSyncModernElicitationSpecificationrecord class. -
Uses of ToolContext in org.springframework.ai.mcp.annotation.method.progress
Methods in org.springframework.ai.mcp.annotation.method.progress that return types with arguments of type ToolContextModifier and TypeMethodDescriptionBiFunction<io.modelcontextprotocol.modern.McpSchema.ProgressParams,@Nullable ToolContext, reactor.core.publisher.Mono<Void>> AsyncModernProgressSpecification.progressHandler()Returns the value of theprogressHandlerrecord component.BiConsumer<io.modelcontextprotocol.modern.McpSchema.ProgressParams,@Nullable ToolContext> SyncModernProgressSpecification.progressHandler()Returns the value of theprogressHandlerrecord component.Methods in org.springframework.ai.mcp.annotation.method.progress with parameters of type ToolContextModifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>AsyncMcpProgressMethodCallback.acceptModern(io.modelcontextprotocol.modern.McpSchema.ProgressParams progress, @Nullable ToolContext toolContext) Accepts the progress of a modern client, for a tool call with the given tool context.voidSyncMcpProgressMethodCallback.acceptModern(io.modelcontextprotocol.modern.McpSchema.ProgressParams progress, @Nullable ToolContext toolContext) Accept the progress of a modern client, for a tool call with the given tool context.Constructor parameters in org.springframework.ai.mcp.annotation.method.progress with type arguments of type ToolContextModifierConstructorDescriptionAsyncModernProgressSpecification(String[] clients, BiFunction<io.modelcontextprotocol.modern.McpSchema.ProgressParams, @Nullable ToolContext, reactor.core.publisher.Mono<Void>> progressHandler) Creates an instance of aAsyncModernProgressSpecificationrecord class.SyncModernProgressSpecification(String[] clients, BiConsumer<io.modelcontextprotocol.modern.McpSchema.ProgressParams, @Nullable ToolContext> progressHandler) Creates an instance of aSyncModernProgressSpecificationrecord class. -
Uses of ToolContext in org.springframework.ai.mcp.annotation.spring
Methods in org.springframework.ai.mcp.annotation.spring with parameters of type ToolContextModifier and TypeMethodDescriptionreactor.core.publisher.Mono<io.modelcontextprotocol.modern.McpSchema.ElicitResult>ClientMcpAsyncHandlersRegistry.handleModernElicitation(String name, io.modelcontextprotocol.modern.McpSchema.ElicitRequest elicitationRequest, @Nullable ToolContext toolContext) Invoke the elicitation handler for a given client that speaks the modern revision, for a tool call with the given tool context.io.modelcontextprotocol.modern.McpSchema.ElicitResultClientMcpSyncHandlersRegistry.handleModernElicitation(String name, io.modelcontextprotocol.modern.McpSchema.ElicitRequest elicitationRequest, @Nullable ToolContext toolContext) Invoke the elicitation handler for a given client that speaks the modern revision, for a tool call with the given tool context.reactor.core.publisher.Mono<Void>ClientMcpAsyncHandlersRegistry.handleModernProgress(String name, io.modelcontextprotocol.modern.McpSchema.ProgressParams progress, @Nullable ToolContext toolContext) Invoke all progress handlers for a given client that speaks the modern revision, in sequence, for a tool call with the given tool context.voidClientMcpSyncHandlersRegistry.handleModernProgress(String name, io.modelcontextprotocol.modern.McpSchema.ProgressParams progress, @Nullable ToolContext toolContext) Invoke all progress handlers for a given client that speaks the modern revision, for a tool call with the given tool context. -
Uses of ToolContext in org.springframework.ai.mcp.modern
Methods in org.springframework.ai.mcp.modern with parameters of type ToolContextModifier and TypeMethodDescriptionstatic @Nullable io.modelcontextprotocol.modern.server.McpRequestContextMcpModernToolUtils.getMcpRequestContext(@Nullable ToolContext toolContext) Retrieves theMcpRequestContextof the current tool call from theToolContext, if the callback is being invoked by a modern MCP server. -
Uses of ToolContext in org.springframework.ai.mcp.modern.client
Methods in org.springframework.ai.mcp.modern.client with parameters of type ToolContextModifier and TypeMethodDescriptionAsyncModernMcpToolCallback.call(String toolCallInput, @Nullable ToolContext toolContext) SyncModernMcpToolCallback.call(String toolCallInput, @Nullable ToolContext toolContext) io.modelcontextprotocol.modern.client.McpAsyncClient.ToolSpecAsyncModernMcpToolCallCustomizer.customize(McpModernConnectionInfo connectionInfo, io.modelcontextprotocol.modern.client.McpAsyncClient.ToolSpec toolSpec, @Nullable ToolContext toolContext) Customizes the request spec of a tool call.io.modelcontextprotocol.modern.client.McpSyncClient.ToolSpecSyncModernMcpToolCallCustomizer.customize(McpModernConnectionInfo connectionInfo, io.modelcontextprotocol.modern.client.McpSyncClient.ToolSpec toolSpec, @Nullable ToolContext toolContext) Customizes the request spec of a tool call. -
Uses of ToolContext in org.springframework.ai.session.tool
Methods in org.springframework.ai.session.tool with parameters of type ToolContextModifier and TypeMethodDescriptionSessionRecallTools.conversationSearch(String query, @Nullable String match, @Nullable Integer page, ToolContext toolContext) Searches the session's conversation for messages that contain the keywords. -
Uses of ToolContext in org.springframework.ai.tool
Methods in org.springframework.ai.tool with parameters of type ToolContextModifier and TypeMethodDescriptiondefault StringToolCallback.call(String toolInput, @Nullable ToolContext toolContext) Execute tool with the given input and context, and return the result to send back to the AI model. -
Uses of ToolContext in org.springframework.ai.tool.augment
Methods in org.springframework.ai.tool.augment with parameters of type ToolContextModifier and TypeMethodDescriptionAugmentedToolCallback.call(String toolInput, @Nullable ToolContext tooContext) -
Uses of ToolContext in org.springframework.ai.tool.function
Methods in org.springframework.ai.tool.function with parameters of type ToolContextModifier and TypeMethodDescriptionFunctionToolCallback.call(String toolInput, @Nullable ToolContext toolContext) Method parameters in org.springframework.ai.tool.function with type arguments of type ToolContextModifier and TypeMethodDescriptionstatic <I,O> FunctionToolCallback.Builder<I, O> FunctionToolCallback.builder(String name, BiFunction<@Nullable I, @Nullable ToolContext, O> function) Build aFunctionToolCallbackfrom aBiFunction.Constructor parameters in org.springframework.ai.tool.function with type arguments of type ToolContextModifierConstructorDescriptionFunctionToolCallback(ToolDefinition toolDefinition, @Nullable ToolMetadata toolMetadata, Type toolInputType, BiFunction<@Nullable I, @Nullable ToolContext, O> toolFunction, @Nullable ToolCallResultConverter toolCallResultConverter) -
Uses of ToolContext in org.springframework.ai.tool.method
Methods in org.springframework.ai.tool.method with parameters of type ToolContextModifier and TypeMethodDescriptionMethodToolCallback.call(String toolInput, @Nullable ToolContext toolContext) -
Uses of ToolContext in org.springframework.ai.tool.toolsearch
Methods in org.springframework.ai.tool.toolsearch with parameters of type ToolContextModifier and TypeMethodDescriptionToolSearchTool.toolSearchTool(String query, Integer maxResults, String categoryFilter, ToolContext toolContext)