MCPcopy Create free account
hub / github.com/anomalyco/opencode / markLastTool

Function markLastTool

packages/llm/src/cache-policy.ts:47–52  ·  view source on GitHub ↗
(tools: ReadonlyArray<ToolDefinition>, hint: CacheHint)

Source from the content-addressed store, hash-verified

45 ttlSeconds !== undefined ? new CacheHint({ type: "ephemeral", ttlSeconds }) : new CacheHint({ type: "ephemeral" })
46
47const markLastTool = (tools: ReadonlyArray<ToolDefinition>, hint: CacheHint): ReadonlyArray<ToolDefinition> => {
48 if (tools.length === 0) return tools
49 const last = tools.length - 1
50 if (tools[last]!.cache) return tools
51 return tools.map((tool, i) => (i === last ? new ToolDefinition({ ...tool, cache: hint }) : tool))
52}
53
54const markLastSystem = (system: LLMRequest["system"], hint: CacheHint): LLMRequest["system"] => {
55 if (system.length === 0) return system

Callers 1

applyCachePolicyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected