Skip to content

Comments

fix: add UnsupportedCapabilityError to handle capabilities custom exception#1329

Open
matteo-gobbo wants to merge 8 commits intomodelcontextprotocol:mainfrom
matteo-gobbo:supported-capabilities-custom-exception
Open

fix: add UnsupportedCapabilityError to handle capabilities custom exception#1329
matteo-gobbo wants to merge 8 commits intomodelcontextprotocol:mainfrom
matteo-gobbo:supported-capabilities-custom-exception

Conversation

@matteo-gobbo
Copy link

@matteo-gobbo matteo-gobbo commented Dec 20, 2025

Replace generic Error with UnsupportedCapabilityError when capabilities are not supported, allowing applications to distinguish capability errors from actual failures.

Motivation and Context

It fixes the issue #430

How Has This Been Tested?

Breaking Changes

There are no breaking changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Added UnsupportedCapabilityError class in packages/core/src/types/types.ts.
I assigned to it an error code of -32043 following what's been done before, but it should be checked if it's correct.

Open Source Saturday

@changeset-bot
Copy link

changeset-bot bot commented Dec 20, 2025

⚠️ No Changeset found

Latest commit: 3086e54

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 20, 2025

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1329

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1329

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1329

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1329

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1329

commit: 3086e54

@matteo-gobbo matteo-gobbo marked this pull request as ready for review December 20, 2025 14:49
@matteo-gobbo matteo-gobbo requested a review from a team as a code owner December 20, 2025 14:49
Copy link
Contributor

@KKonstantinov KKonstantinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you for this. The idea if differentiating on various Errors is something we should apply in other places too so users can distinguish them easier.

I've left two comments to be addressed please

@matteo-gobbo
Copy link
Author

Hi @KKonstantinov, I think this PR is no longer needed and should be closed due to #1454.
Am I right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants