Skip to content

Make remote tool-call timeout configurable, lift 60s SDK default#36

Merged
eshwar-sundar-glean merged 1 commit into
mainfrom
fix-remote-tool-timeout
Jul 3, 2026
Merged

Make remote tool-call timeout configurable, lift 60s SDK default#36
eshwar-sundar-glean merged 1 commit into
mainfrom
fix-remote-tool-timeout

Conversation

@eshwar-sundar-glean

@eshwar-sundar-glean eshwar-sundar-glean commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Problem

Customer escalation - Chat failure

Every downstream tool call went through callRemoteToolclient.callTool({ name, arguments }) with no options, so the MCP SDK applied its hardcoded DEFAULT_REQUEST_TIMEOUT_MSEC (60s). Any tool that took longer than 60s — invoked via run_tool, find_skills, or the remote passthrough — failed with RequestTimeout.

Fix

Pass an explicit per-call timeout to callTool, configurable via a new env var GLEAN_REMOTE_TOOL_TIMEOUT_MS:

  • Positive integer; default 300000 (5 min), mirroring HITL_TIMEOUT_MS.
  • Falls back to the default on unset / invalid / non-positive values.
  • A single predictable knob — the env var is the timeout (no resetTimeoutOnProgress), so its name means exactly what it says. Easy to extend later for progress-streaming tools if needed.

Changes

  • src/remote-client.ts — add exported remoteToolTimeoutMs(); thread the timeout into callTool's request options (resultSchema passed as undefined to keep the SDK default).
  • README.md — document the new env var in the config table.
  • tests/remote-client.test.ts — cover remoteToolTimeoutMs() (default, override, non-numeric, zero/negative) and callRemoteTool (timeout passthrough + contentless-result normalization).
  • tests/find-skills.test.ts — update assertions for the new three-arg callTool signature.

Plugin manifests auto-bumped to 0.2.38 by the pre-commit hook.

Verification

  • tsc --noEmit clean
  • Full suite: 185/185 passing
  • Confirmed GLEAN_REMOTE_TOOL_TIMEOUT_MS is present in the rebuilt plugins/glean/dist/index.js

Usage

Set in the host's MCP env block or shell, e.g. GLEAN_REMOTE_TOOL_TIMEOUT_MS=600000 for a 10-minute ceiling.

Every downstream tool call went through callRemoteTool ->
client.callTool({ name, arguments }) with no options, so the MCP SDK
applied its hardcoded DEFAULT_REQUEST_TIMEOUT_MSEC (60s). Any tool that
took longer than 60s failed with RequestTimeout.

Pass an explicit per-call timeout, configurable via
GLEAN_REMOTE_TOOL_TIMEOUT_MS (positive integer, default 300000ms /
5 min, mirroring HITL_TIMEOUT_MS). Falls back to the default on
unset/invalid/non-positive values.

- src/remote-client.ts: add exported remoteToolTimeoutMs(); thread the
  timeout into callTool's request options.
- README.md: document the new env var.
- tests: cover the helper and callRemoteTool's timeout passthrough;
  update find-skills assertions for the new three-arg callTool signature.
@eshwar-sundar-glean
eshwar-sundar-glean force-pushed the fix-remote-tool-timeout branch from f1fce93 to 51573da Compare July 3, 2026 07:15
@eshwar-sundar-glean
eshwar-sundar-glean merged commit 5b01db2 into main Jul 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants