ToolCallContext

Framework-agnostic, immutable context passed to tools at call time. Carries out-of-band metadata such as auth tokens, tenant IDs, or correlation IDs without polluting the tool's JSON input schema.

Context flows explicitly through the Tool.call two-arg overload and is propagated through decorator chains by DelegatingTool.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
operator fun contains(key: String): Boolean

Check whether the context contains a given key. Supports Kotlin in operator: "token" in ctx.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun <T> get(key: String): T?

Retrieve a value by key, cast to the expected type. Returns null when the key is absent.

Link copied to clipboard
fun <T> getOrDefault(key: String, default: T): T

Retrieve a value by key, returning default when absent.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun loopId(): String?

Unique identifier of the agentic-loop iteration in which this tool call is happening, or null when the calling action did not set one.

Link copied to clipboard

Merge this context with other. Values in other win on conflict.

Link copied to clipboard
fun toMap(): Map<String, Any>

Snapshot as an unmodifiable map, safe to hand to Spring AI org.springframework.ai.chat.model.ToolContext.

Link copied to clipboard
open override fun toString(): String