Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rahulkarajgikar opened this issue Apr 30, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@rahulkarajgikar
Copy link

rahulkarajgikar commented Apr 30, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant