Skip to content

Conversation

@koic
Copy link
Member

@koic koic commented May 29, 2025

Motivation and Context

According to the specification, the following attributes are optional, so using compact ensures consistency.

  • description: Optional description
  • mimeType: Optional MIME type
  • size: Optional size in bytes

https://modelcontextprotocol.io/specification/2025-03-26/server/resources#resource

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

According to the specification, the following attributes are optional,
so using `compact` ensures consistency.

- `description`: Optional description
- `mimeType`: Optional MIME type
- `size`: Optional size in bytes

https://modelcontextprotocol.io/specification/2025-03-26/server/resources#resource
@koic koic force-pushed the suppress_redundant_attributes_in_resources branch from 1d9533c to 2f354a8 Compare May 30, 2025 01:41
@atesgoral atesgoral merged commit 8db094d into modelcontextprotocol:main May 30, 2025
4 checks passed
@koic koic deleted the suppress_redundant_attributes_in_resources branch May 30, 2025 04:26
koic added a commit to koic/ruby-sdk that referenced this pull request May 31, 2025
…ource`

This change is related to modelcontextprotocol#29.

According to the specification, both `description` and `mimeType` of Resource are optional:
https://modelcontextprotocol.io/specification/2025-03-26/server/resources#resource

Therefore, it makes sense to treat them as optional keyword arguments,
similar to how this is done in `ResourceTemplate`:
https://github.com/modelcontextprotocol/ruby-sdk/blob/0b49c3/lib/mcp/resource_template.rb#L8

As additional context, the TypeScript SDK also treats them as optional.
https://github.com/modelcontextprotocol/typescript-sdk/blob/1.12.1/src/types.ts#L438-L466
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