Skip to content

Conversation

ZachGerman
Copy link
Contributor

@ZachGerman ZachGerman commented Aug 21, 2025

Adding explicit guidance for returning HTTP errors when input is not acceptable, explicitly requiring a 406 status code for unmet Accept header requirements and 400 status for unmet request body requirements.

Motivation and Context

There's varying behavior among SDKs when handling specified Accept header and request body requirements, with at least one returning HTTP status 500 (Internal Server Error) errors instead of 406 or 400 respectively. Status 500 should be used when the reason isn't known, as opposed to cases where the reason is known through explicit header and request body validation.

How Has This Been Tested?

Generated, checked, and verified local preview.

Breaking Changes

Some SDKs will need to update the error they return in the explicitly defined cases.

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

@ZachGerman ZachGerman requested a review from a team as a code owner August 21, 2025 04:54
@ZachGerman ZachGerman force-pushed the accept-header-error branch from 4bb6101 to 49c42bd Compare August 21, 2025 05:03
@ZachGerman ZachGerman changed the title Adding explicit HTTP 400 Bad Request guidance Adding explicit HTTP error guidance Aug 21, 2025
@dend
Copy link
Contributor

dend commented Aug 22, 2025

For the error codes, is there an RFC we can link to for normative guidance?

@ZachGerman ZachGerman marked this pull request as draft August 22, 2025 04:27
@ZachGerman
Copy link
Contributor Author

ZachGerman commented Aug 22, 2025

For the error codes, is there an RFC we can link to for normative guidance?

That's a great suggestion! I should add some citations that guided my decisions for these as well!
Also, converted back into a draft because this should be SEP-style, so going to convert it into that format.

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