Skip to content

feat: Add ResourceLink #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

bzsurbhi
Copy link
Contributor

Implement ResourceLink as defined in the spec

Motivation and Context

Adds a missing ResourceLink type from the most recent specification version

How Has This Been Tested?

Added unit tests

Breaking Changes

None

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

@tzolov tzolov added this to the 0.11.0 milestone Jun 26, 2025
@tzolov tzolov self-assigned this Jun 26, 2025
Copy link
Contributor

@tzolov tzolov left a comment

Choose a reason for hiding this comment

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

Thanks @bzsurbhi,

Please check my comments and let me know what do you think?

@@ -1601,6 +1605,18 @@ public Double priority() {
}
}

@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonIgnoreProperties(ignoreUnknown = true)
public record ResourceLink( // @formatter:off
Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment, the ResourceLink content is equivalent to the existing Resource type.
Unfortunately, Java doesn't allow record inheritance. Perhaps we should consider a common interface (not sure how to call it? Perhaps ResourceType ) that both Resource and ResourceLink would implement.

Also it will be useful to have Builder for the ResourceLink similar to the Resource's builder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, I'll push an update

@bzsurbhi bzsurbhi requested a review from tzolov June 26, 2025 20:48
tzolov pushed a commit that referenced this pull request Jun 27, 2025
- Add ResourceContent interface with common resource metadata methods
- Implement ResourceContent in existing Resource class
- Add new ResourceLink record class implementing Content and ResourceContent
- Update Content interface to support ResourceLink with "resource_link" type (breaking!)
- Add tests for ResourceLink serialization/deserialization
- Update test expectations to include new resource_link type

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov
Copy link
Contributor

tzolov commented Jun 27, 2025

Thank you @bzsurbhi
I've renamed ResourceType interface into ResourceContent and change the field order of the ResourceLink to match the Resource one.

@tzolov
Copy link
Contributor

tzolov commented Jun 27, 2025

rebased, squashed, minor adjustments and merged at 2f55dd0

@tzolov tzolov closed this Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants