fix: convert remaining capability throws to SdkError by felixweinberger · Pull Request #1761 · modelcontextprotocol/typescript-sdk

@felixweinberger @gotamm

Follow-up to #1454. Converts the 6 capability-assertion call sites that
were missed to throw SdkError(SdkErrorCode.CapabilityNotSupported, ...)
instead of plain Error:

- Client.assertCapability() in packages/client/src/client/client.ts
- assertToolsCallTaskCapability() in experimental/tasks/helpers.ts (2 throws)
- assertClientRequestTaskCapability() in experimental/tasks/helpers.ts (3 throws)

Fixes #430
Closes #1329

Co-authored-by: Matteo Gobbo <info@matteogobbo.it>

claude[bot]

@felixweinberger @gotamm

Adds the 3 capability checks in experimental/tasks/server.ts that were
missed in the initial sweep: sampling tools (L125), url elicitation
(L224), form elicitation (L230).

Co-authored-by: Matteo Gobbo <info@matteogobbo.it>

claude[bot]

bhosmer-ant

KKonstantinov

@KKonstantinov

claude[bot]

This was referenced

Mar 27, 2026