server : cancel MCP tool calls on client disconnect or timeout (#32025)

* server : cancel MCP tool calls on client disconnect or timeout

* server : shorten MCP cancellation tests and fix a type-check error
This commit is contained in:
Hamish M. Blair authored and GitHub committed 2026-11-12 17:19:26 +01:00
1 parent 3ba1ce0e28
commit d8c8cc4d9b
7 files changed
+100 -23

No files matched your search

+2
View File
@@ -239,6 +239,8 @@ That requires `JSON.stringify` when formatted to message content:
}
```
When the client disconnects during an MCP tool call, or the call exceeds `timeout_ms`, `llama-server` sends `notifications/cancelled` with the request id to the MCP server and returns an error.
Set `stream: true` in the request body to stream a tool's output as it runs, instead of waiting for it to finish. Only certain tools accept this (for ex. `exec_shell_command`);
returns 404 if tool doesn't support it.