Repository navigation
Conversation
A tool call through an MCP connector was cut after the connector package default of 60 seconds, while the model's own MCP servers allow 360 seconds. Research and document tools behind a connector take minutes, so a saved agent lost them mid-turn with "connection closed: calling tools/call: client is closing" and the model fell back to a weaker tool. The connector service now gets the MCP tool timeout the rest of LocalAI uses (DistributedConfig.MCPToolTimeoutOrDefault, 360 s by default). The package default and the per-call output cap are unchanged. Tests in core/application start the connector service on JSON stores against a slow MCP server: the timeout defaults to the MCP tool timeout, a tool slower than the old cap but within the timeout returns, and a tool past the timeout is still stopped. Docs: chats-connectors.md, "How chats use them". Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>
2 tasks done
Collaborator
|
Thank you for this fix. It is now on master, bundled with a few related fixes in #13044, with your commits and authorship kept (MCP connector call timeout). Some small follow-up changes were needed while rebasing on current master; they are in the same series. Closing this PR as it is now redundant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A tool call through an MCP connector (the MCP servers users add under Chats, Connectors) is cut after 60 seconds, the
mcpconns.DefaultCallTimeout, becauseinitStudioMCPConnectorsnever setsCallTimeout. The model's own MCP servers allow 360 seconds (DistributedConfig.MCPToolTimeoutOrDefault,DefaultMCPToolTimeout). Research and document tools behind a connector often need several minutes, so a chat or saved agent loses them mid-turn withand the model falls back to a weaker tool.
What the change does:
initStudioMCPConnectorspassesCallTimeout: a.studioMCPCallTimeout(), which returnsapplicationConfig.Distributed.MCPToolTimeoutOrDefault()— the same timeout the rest of LocalAI uses for MCP tool calls (360 s unless configured otherwise). Themcpconnspackage default and the 64 KiB per-call output cap are unchanged.How it was tested
New Ginkgo specs in
core/application/studio_mcpconns_timeout_internal_test.gostart the connector service on JSON stores against a local MCP server (httptest) with one tool that sleeps:config.DefaultMCPToolTimeout(and is longer thanmcpconns.DefaultCallTimeout);CallTimeout:line removed, this spec fails ("Expected an error to have occurred"), the other two pass; with the line it passes.All packages pass except
core/services/studio/store, spec "the GORM store on SQLite: a turn that stops beating is reaped, one that keeps beating is not" (storetest/contract.go:590, both turns reaped). It fails the same way on unmodified master 5b2414f (also withTZ=UTC), and this PR does not touch that package.gofmt -lis clean andgo vet -tags "debug auth"reports nothing for./core/application/.Docs
docs/content/features/chats-connectors.md, "How chats use them", Limits: the call time limit is now the MCP tool timeout (360 seconds) instead of 60 seconds.Signed commits
The commit carries an
Assisted-by:trailer per.agents/ai-coding-assistants.md.