python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Per-tool timeout overrides

Open dgenio opened this issue 1 month ago • 0 comments

Description

Context

https://github.com/modelcontextprotocol/python-sdk/pull/1685 implemented server-wide tool execution timeouts with a default of 300 seconds.

Motivation

Some tools may need different timeout values:

  • Quick lookups: get_weather() - 10 seconds
  • Heavy processing: analyze_dataset() - 20 minutes

Proposed API

# Server default
mcp = FastMCP("MyServer", tool_timeout_seconds=300)

# Per-tool override
@mcp.tool(timeout_seconds=1200)  # 20 minutes
async def analyze_large_dataset(data: str) -> dict:
    ...

Questions

  • Is this needed in practice, or is the server-wide timeout sufficient?
  • Should None mean "use server default" or "no timeout"?
  • Should this be per-tool or per-call?

Non-Goals (for this issue)

  • Client-side timeout control (separate concern)
  • Retry policies (separate concern)

References

No response

dgenio avatar Nov 28 '25 12:11 dgenio