Skip to content

Conversation

nilcolor
Copy link
Contributor

This change allows you to declare the output schema as an array of objects.
When building an MCP, you might want to return a list of results while still providing a schema for those results. This helps clients better understand the data being returned.

Motivation and Context

One of the MCPs I'm building need to respond with list of items. And I'd like to provide a schema for this. Currently this is not possible (#142).

How Has This Been Tested?

I tried to test in @modelcontextprotocol/inspector but Inspector doesn't support it yet (modelcontextprotocol/inspector#552)
In real application it seems to work fine.

Breaking Changes

OutputSchema class no longer expose #properties, #required. But most likely they were not used by any consumer. Other than this, no breaking changes and user do not need to update existing configurations.

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

@nilcolor
Copy link
Contributor Author

@koic Thank you. I've updated PR with your suggestions.

@koic
Copy link
Member

koic commented Sep 25, 2025

@nilcolor This looks good to me. Can you squash your commits into one?

@nilcolor nilcolor force-pushed the output_schema_arrays branch from 31ecd87 to 4ee128a Compare September 25, 2025 06:56
@nilcolor
Copy link
Contributor Author

@koic Done

@koic koic merged commit de1e833 into modelcontextprotocol:main Sep 27, 2025
5 checks passed
@nilcolor nilcolor deleted the output_schema_arrays branch September 30, 2025 09:15
@topherbullock topherbullock mentioned this pull request Oct 15, 2025
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