Skip to content

Client class should throw a custom exception if the capability is unsupported #430

Closed

Description

@rahulkarajgikar

Is your feature request related to a problem? Please describe.
Currently, MCP Client class in https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/client/index.ts throws Error when a capability isn't supported by a server. While building any MCP client applications, this makes it hard to know, when i call client.listPrompts and get back an exception - if the exception was because of an actual failure or because the capability isn't supported

Describe the solution you'd like
Client class should throw a custom exception like UnsupportedCapabilityException when the capability itself isn't supported - this makes it easy to write clients around this logic

Describe alternatives you've considered
Currently i am working around this by grepping the returned exception message to see if it contains the string does not support. This is very brittle and can break easily if the exception message changes

Activity

  1. added
    good first issueGood for newcomers - can be tackled without deep knowledge of the codebase
    P3Nice to haves, rare edge cases
    on Dec 16, 2025
  2. codewithkenzo commented on Feb 2, 2026

    @codewithkenzo
    Contributor

    Just noting that PR #1329 by @matteo-gobbo addresses this and looks ready - CI is green and the reviewer feedback has been addressed.

    The approach (extending Error rather than McpError) makes sense since this is an implementation-level error, not a protocol-level one.

  3. added a commit that references this issue on Mar 25, 2026
    9153c8f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Nice to haves, rare edge casesenhancementRequest for a new feature that's not currently supportedgood first issueGood for newcomers - can be tackled without deep knowledge of the codebase

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions