Commit b1307d0
fix: add missing 'items' attribute for MCP array parameters
This fixes an issue where MCP tools with array parameters were not working
correctly with OpenAI-compatible LLMs. The tools were missing the required
'items' attribute that specifies the type of elements in the array.
- Added _fix_array_schemas() method to recursively fix array schemas
- Updated to_openai_tool() in both mcp.py and mcp_sse.py to apply the fix
- Maintains backward compatibility by preserving existing schemas
Fixes #619
Co-authored-by: Mervin Praison <[email protected]>1 parent 53c0b84 commit b1307d0
2 files changed
+80
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
382 | 419 | | |
383 | 420 | | |
384 | 421 | | |
| |||
404 | 441 | | |
405 | 442 | | |
406 | 443 | | |
407 | | - | |
| 444 | + | |
| 445 | + | |
408 | 446 | | |
409 | 447 | | |
410 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
91 | 128 | | |
92 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
93 | 133 | | |
94 | 134 | | |
95 | 135 | | |
96 | 136 | | |
97 | 137 | | |
98 | | - | |
| 138 | + | |
99 | 139 | | |
100 | 140 | | |
101 | 141 | | |
| |||
0 commit comments