Skip to content

Add MCP_TOOL_TIMEOUT_MSEC default value only for tool calls. #1863

@haydenrear

Description

@haydenrear

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I've submitted a PR for updating the request timeout, and reviewed it a bit, so we can set the default request timeout for all requests. Now, I'd like to pull out the function for retrieving the ENV into a helper function and reuse it for only client tool calls.

Here's the PR I want to build on:

#1854

Describe the solution you'd like
A clear and concise description of what you want to happen.

Add an env for default tool call milliseconds in client.ts.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Only having it for all requests.

Additional context
Add any other context or screenshots about the feature request here.

Here is how I envision the precedence:

All requests have a 60-second default timeout. The timeout for a given request is resolved in the following order of precedence (highest first):
Per-request timeout option — passed directly in the request options.
MCP_TOOL_TIMEOUT_MSEC — environment variable that applies only to tools/call requests.
MCP_REQUEST_TIMEOUT_MSEC — environment variable that applies to all requests.
60,000 ms — hardcoded fallback.

By the way, I was also thinking about defaulting to MCP_TOOL_TIMEOUT - to align with claude, which uses typescript SDK? However, this seems less idiomatic because this code base seems to append MSEC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequest for a new feature that's not currently supported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions