mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-27 04:07:05 +00:00
fix(mcp): keep app tool calls alive on progress and always send tool input
Sets resetTimeoutOnProgress on app-initiated tool calls so a long-running tool that keeps streaming MCP progress is not aborted at the fixed connection timeout, matching the model-initiated callTool path. Always sends the tool-input notification before the result, even when the tool has no arguments. MCP Apps expect ui tool-input exactly once before the result, so apps that initialize from ontoolinput no longer stay blank for no-argument tools.
This commit is contained in:
parent
c9f5441b0d
commit
4261adcd5d
2 changed files with 6 additions and 6 deletions
|
|
@ -155,11 +155,11 @@ export function useAppBridge(
|
|||
bridge.oninitialized = async () => {
|
||||
const args = toolArgsRef.current;
|
||||
const result = toolResultRef.current;
|
||||
if (args) {
|
||||
await bridge!
|
||||
.sendToolInput({ arguments: args })
|
||||
.catch((err: unknown) => logger.error('[MCP App] sendToolInput failed', err));
|
||||
}
|
||||
// MCP Apps expect tool input exactly once before the result, even for no-argument tools,
|
||||
// so apps that initialize from ontoolinput always receive it.
|
||||
await bridge!
|
||||
.sendToolInput({ arguments: args ?? {} })
|
||||
.catch((err: unknown) => logger.error('[MCP App] sendToolInput failed', err));
|
||||
if (result) {
|
||||
await bridge!
|
||||
.sendToolResult(result as never)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue