mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
An upstream that ends its response stream without a JSON-RPC reply leaves the request pending forever. Tool discovery then only ended when an outer cancel scope killed it, which logged a cancelled list_tools, ignored the timeout the operator configured, and reported no tools to the client. Prompts and resources had no outer guard at all. Give the client session a read timeout so every request it sends is bounded, including initialize. The SDK reports its own elapsed timeout as an McpError carrying an HTTP status code in the field that otherwise holds JSON-RPC error codes, and it relays an upstream's JSON-RPC error through that same class and field, so the code alone cannot separate the two: an upstream answering with application code 408 would be blamed on the gateway as a 504. Translate the SDK's timeout into a TimeoutError in the module that configures the timeout, matching on the elapsed timeout in the exception's context chain rather than on the number, so the listing taxonomy never has to read a JSON-RPC code as an HTTP status and every caller gets the same signal. The bare cancellation warning is replaced by a line naming the server and the budget that elapsed, and quiet_on_error does not demote it. |
||
|---|---|---|
| .. | ||
| test_mcp_client.py | ||
| test_tools.py | ||