Skip to main content

Function: applyLastToolCacheControl()

applyLastToolCacheControl<T>(tools, ttl?, wire?): T | null | undefined

Defined in: packages/core/src/prompt-cache.ts:208

Stamp the last always-loaded tool when the plan is on and no tool already carries a stamp. Does not mutate tools — returns a shallow copy only when a stamp is added.

"Last" is last on the wire: pass the call's activeTools / toolOrder and the stamp lands on the last always-loaded tool AI SDK will actually send. Without them, a stamp could land on a tool activeTools excluded, leaving no tool on the wire with a breakpoint (a silent tools-prefix miss).

Type Parameters​

T​

T extends Record<string, unknown>

Parameters​

tools​

T | null | undefined

ttl?​

AnthropicCacheTtl

wire?​

activeTools?​

readonly string[]

toolOrder?​

readonly string[]

Returns​

T | null | undefined