| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This change enables MCP servers to include metadata in resource content using the _meta field, which is part of the MCP specification. This allows servers to provide additional context about resources, such as domain information or other custom metadata. Changes: - Added meta field to ReadResourceContents helper class - Added _meta field to Resource base class with proper alias - Updated lowlevel server handler to pass through _meta when creating TextResourceContents and BlobResourceContents - Updated FastMCP server to pass resource._meta to ReadResourceContents - Added comprehensive tests for _meta support in both lowlevel and FastMCP resources The implementation maintains backward compatibility - resources without _meta continue to work as before with meta=None.
Adds tests to verify that _meta attributes are correctly serialized with the underscore prefix in JSON output, not as "meta". This ensures the implementation conforms to the MCP specification where metadata fields use the _meta key. Tests verify: - Resource serialization includes "_meta" key in JSON - Response content serialization includes "_meta" key - JSON strings contain the literal "_meta" key - No "meta" key appears in serialized output
…ontents
Use the field name 'meta' instead of the alias '_meta' when constructing
Pydantic model instances. The alias is only used for JSON serialization.
This fixes a bug where passing **{'_meta': meta} would cause Pydantic
validation errors since '_meta' is an alias, not a field name.
|
Before this is merged, is there any workaround? |
Sorry, something went wrong.
|
Thanks for the PR. This has since landed via #1840. Closing this as part of a wider backlog cleanup following the v2 launch. If it's still relevant, feel free to reopen. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This change enables MCP servers to include metadata in resource content using the _meta field, which is part of the MCP specification. This allows servers to provide additional context about resources, such as domain information or other custom metadata.
Changes:
The implementation maintains backward compatibility - resources without _meta continue to work as before with meta=None.
Motivation and Context
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context