(tools)
| 458 | console.log('\n📦 [3] Cursor 扁平格式工具兼容\n'); |
| 459 | |
| 460 | function convertTools(tools) { |
| 461 | return tools.map(t => { |
| 462 | if ('function' in t && t.function) { |
| 463 | return { |
| 464 | name: t.function.name, |
| 465 | description: t.function.description, |
| 466 | input_schema: t.function.parameters || { type: 'object', properties: {} }, |
| 467 | }; |
| 468 | } |
| 469 | return { |
| 470 | name: t.name || '', |
| 471 | description: t.description, |
| 472 | input_schema: t.input_schema || { type: 'object', properties: {} }, |
| 473 | }; |
| 474 | }); |
| 475 | } |
| 476 | |
| 477 | test('标准 OpenAI 格式工具', () => { |
| 478 | const tools = convertTools([{ |
no outgoing calls
no test coverage detected