How to handle long-running MCP tools without breaking AI agent workflows
Developers building MCP servers face a hidden challenge when tool calls take minutes rather than seconds, as most MCP clients impose their own timeouts that the server cannot control. A single blocking tool call risks silent failures across different clients like Claude Desktop or Cursor, depending on each client's deadline. Letting the AI model handle polling independently also backfires, as agents tend to abandon long-running tasks prematurely and flood the context window with repeated status objects. A more reliable pattern splits the workflow into three distinct tools: one that starts the job and returns immediately, one that checks status on demand, and one that blocks server-side until the task reaches a terminal state. This approach keeps the server in control of the waiting loop while giving the model clear, minimal decision points and a single result entry in the transcript.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in