Commit f8cd906
committed
fix: honor tool_call_timeout so slow MCP tool calls stop hanging
MCPStreamableHTTPClient builds its httpx client without a timeout, so httpx's
5 second default governs the MCP read stream. The transport takes a pre-built
client and has no timeout arguments of its own, so nothing else applies. When a
tool takes longer, the server finishes the work and writes the reply to a stream
httpx already dropped. Nothing raises, so the caller hangs.
tool_call_timeout should have caught this at 60 seconds, but it was stored and
never passed to ClientSession(read_timeout_seconds=...), so the documented
timeout was dead and the real limit was an undocumented 5 seconds.
Streamable-http now passes tool_call_timeout to httpx and keeps connect at 5
seconds, since establishing a connection is not a tool call. All three
transports pass read_timeout_seconds to ClientSession. create_mcp_client and
MCPManager.create_from_server accept tool_call_timeout, which create_from_server
previously had no way to set despite being the documented entry point.
Signed-off-by: Aditya Pandey <aditypandey@nvidia.com>1 parent bc6fba1 commit f8cd906
3 files changed
Lines changed: 116 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
123 | | - | |
| 127 | + | |
124 | 128 | | |
125 | 129 | | |
126 | 130 | | |
| |||
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
200 | | - | |
| 204 | + | |
201 | 205 | | |
202 | 206 | | |
203 | 207 | | |
| |||
273 | 277 | | |
274 | 278 | | |
275 | 279 | | |
276 | | - | |
277 | | - | |
278 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
279 | 293 | | |
280 | 294 | | |
281 | 295 | | |
| |||
288 | 302 | | |
289 | 303 | | |
290 | 304 | | |
291 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
292 | 308 | | |
293 | 309 | | |
294 | 310 | | |
| |||
303 | 319 | | |
304 | 320 | | |
305 | 321 | | |
| 322 | + | |
306 | 323 | | |
307 | 324 | | |
308 | 325 | | |
| |||
313 | 330 | | |
314 | 331 | | |
315 | 332 | | |
| 333 | + | |
316 | 334 | | |
317 | 335 | | |
318 | 336 | | |
| |||
328 | 346 | | |
329 | 347 | | |
330 | 348 | | |
331 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
332 | 352 | | |
333 | 353 | | |
334 | 354 | | |
335 | | - | |
| 355 | + | |
336 | 356 | | |
337 | 357 | | |
338 | 358 | | |
339 | | - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
340 | 362 | | |
341 | 363 | | |
342 | 364 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
767 | 768 | | |
768 | 769 | | |
769 | 770 | | |
| 771 | + | |
770 | 772 | | |
771 | 773 | | |
772 | 774 | | |
| |||
789 | 791 | | |
790 | 792 | | |
791 | 793 | | |
| 794 | + | |
| 795 | + | |
792 | 796 | | |
793 | 797 | | |
794 | 798 | | |
| |||
845 | 849 | | |
846 | 850 | | |
847 | 851 | | |
| 852 | + | |
848 | 853 | | |
849 | 854 | | |
850 | 855 | | |
| |||
890 | 895 | | |
891 | 896 | | |
892 | 897 | | |
| 898 | + | |
893 | 899 | | |
894 | 900 | | |
895 | 901 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 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 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
374 | 451 | | |
375 | 452 | | |
376 | 453 | | |
| |||
439 | 516 | | |
440 | 517 | | |
441 | 518 | | |
442 | | - | |
| 519 | + | |
| 520 | + | |
443 | 521 | | |
444 | 522 | | |
445 | 523 | | |
| |||
0 commit comments