Open History to see the last commit
1import {
2 brandAnthropicProviderTool,
3 getAnthropicProviderToolMetadata,
4} from './anthropic-provider-tool'
5import type { BetaMemoryTool20250818 } from '@anthropic-ai/sdk/resources/beta'
6import type { ProviderTool, Tool } from '@tanstack/ai'
7
8export type MemoryToolConfig = BetaMemoryTool20250818
9
10export type AnthropicMemoryTool = ProviderTool<'anthropic', 'memory'>
11
12export function convertMemoryToolToAdapterFormat(tool: Tool): MemoryToolConfig {
13 const metadata = getAnthropicProviderToolMetadata(tool) as Omit<
14 MemoryToolConfig,
15 'type'
16 >
17 return {
18 type: 'memory_20250818',
19 ...metadata,
20 }
21}
22
23export function memoryTool(config?: MemoryToolConfig): AnthropicMemoryTool {
24 return brandAnthropicProviderTool<AnthropicMemoryTool>(
25 {
26 name: 'memory',
27 description: '',
28 metadata: config,
29 },
30 'memory',
31 )
32}