MCPA Certification Curriculum

Long-Running Work and the Tasks Extension

Blocking a connection until minutes or hours of work finish gives up everything statelessness bought: any replica can no longer answer, and a dropped connection loses the job. The tasks extension trades that blocking call for a durable handle instead. Explain why blocking a request for long-running work fails: request and transport timeouts, no channel for mid-execution input, and no way to recover after a crash. Negotiate the io.modelcontextprotocol/tasks extension per request: declare it in clientCapabilities.extensions and confirm it in server/discover. Read a server-directed CreateTaskResult (resultType: "task") and poll tasks/get, telling the RPC's own resultType apart from the task's nested status. Supply mid-flight input with tasks/update and request cooperative cancellation with tasks/cancel, and explain why both return only an acknowledgement. Tell the current extension apart from the removed 2025-11-25 experimental tasks feature, including what replaced tasks/result and tasks/list. Choose among a plain call, a Multi Round-Trip Request, a task, and a server-minted handle for a given piece of work. Some tool calls cannot finish inside a single request. A CI pipeline, a batch import, a report that needs a human to approve a step partway through: operations like these take seconds, minutes, or longer, and nothing about that duration is a defect to engineer away. Holding the connection open until the last byte of work finishes runs into three separate…

Long-Running Work and the Tasks Extension: Blocking a connection until minutes or hours of work finish gives up everything statelessness bought: any replica…

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.