Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

function-tool.test.ts

32 lines793 Bytes

1import { describe, expect, it } from 'vitest'
2import { convertFunctionToolToAdapterFormat } from './function-tool'
3​
4describe('convertFunctionToolToAdapterFormat', () => {
5 it('preserves composed schemas under the non-strict fallback', () => {
6 const inputSchema = {
7 type: 'object',
8 properties: {
9 value: {
10 oneOf: [{ type: 'string' }, { type: 'number' }],
11 },
12 },
13 required: [],
14 }
15​
16 expect(
17 convertFunctionToolToAdapterFormat({
18 name: 'store_value',
19 description: 'Store a value',
20 inputSchema,
21 }),
22 ).toEqual({
23 type: 'function',
24 function: {
25 name: 'store_value',
26 description: 'Store a value',
27 parameters: inputSchema,
28 strict: false,
29 },
30 })
31 })
32})