ToolCallMetadata

class ToolCallMetadata(content: Map<String, Any?>) : Map<String, Any?> (source)

Immutable, caller-contributed context threaded into Tool.execute alongside the typed arguments.

This is a strictly additive side channel: values are not part of the tool's argument schema, are not serialized to or from the LLM, and must not be relied on for routing or tool selection. Typical use cases are cross-cutting concerns such as a distributed-tracing span identifier, a run-scoped correlation id, or a per-call feature flag contributed by an installed feature.

The class implements Map over String keys to Any? values by delegating to the underlying map, so all standard read-only map operations (get, containsKey, isEmpty, keys, the in operator, and so on) are available directly on the instance without bespoke wrappers.

Instances can be constructed from a Map, built via of, or combined with plus. The EMPTY singleton represents the absence of metadata and is the default passed through the framework.

Constructors

Link copied to clipboard
constructor(content: Map<String, Any?>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val entries: Set<Map.Entry<String, Any?>>
Link copied to clipboard
open override val keys: Set<String>
Link copied to clipboard
open override val size: Int
Link copied to clipboard
open override val values: Collection<Any?>

Functions

Link copied to clipboard
open override fun containsKey(key: String): Boolean
Link copied to clipboard
open override fun containsValue(value: Any?): Boolean
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open operator override fun get(key: String): Any?
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
operator fun plus(other: ToolCallMetadata): ToolCallMetadata
operator fun plus(other: Map<String, Any?>): ToolCallMetadata

Returns a new ToolCallMetadata containing entries from this instance plus other. Entries in other overwrite entries with the same key in this instance.

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