Skip to content

feat: Add resource_link content type support to ToolResults component #564

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

Merged

Conversation

nandsha
Copy link
Contributor

@nandsha nandsha commented Jun 26, 2025

Add ResourceLinkView component for displaying Resource links

Motivation and Context

Adds support for the new resource_link content type. Previously, Resource links in tool results were showing as Invalid Tool Result because the Inspector's ToolResults component lacked rendering support for Resource link.

How Has This Been Tested?

Created test MCP server that returns resource_link content in tool results and verified Resource link display correctly with URI, name, description, and mimeType

image

Breaking Changes

None. This is a purely additive change that adds support for displaying a new content type.

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

  • Implements new resource_link content type support from MCP protocol
  • Added ResourceLinkView component
  • Progressive disclosure for optional metadata (name, description, mimeType)
  • Updated ToolResults.tsx with test coverage for Resource link type

Fixes #553

Add ResourceLinkView component for displaying resource links
@nandsha nandsha changed the title feat: Add resource_link content type support to ToolResults component (fixes #553) feat: Add resource_link content type support to ToolResults component Jun 26, 2025
@nandsha nandsha marked this pull request as ready for review June 26, 2025 12:08
Add ResourceLinkView component for displaying resource links
@nandsha nandsha force-pushed the feat/add-resource-link-support branch from 02f3e93 to 21740bb Compare July 2, 2025 23:03
@richardkmichael
Copy link
Collaborator

#530 is also about ResourceLink

@olaservo
Copy link
Member

olaservo commented Jul 7, 2025

Heads up there was a change added to the Everything reference server recently to include an example of Resource links: modelcontextprotocol/servers#2276

However it has not yet been released to NPM. Will follow up here once that happens. (Typically it takes 1-2 days after merge, since someone from the core team needs to approve publishing the package after a scheduled job runs.)

@cliffhall
Copy link
Member

cliffhall commented Jul 7, 2025

This is absolutely lovely, however, the links themselves actually go nowhere, because it's a URI within the MCP server itself. Clicking them just opens a new tab that doesn't render anything.

What would be perfect would be to send the user to the resources tab and open the given resource with a resources/read request.

Alternatively, this component could send the request, get the result and open a DynamicJSONForm to display the resource in-place.

Screenshot 2025-07-07 at 2 11 48 PM Screenshot 2025-07-07 at 2 17 14 PM Screenshot 2025-07-07 at 2 16 38 PM

@cliffhall
Copy link
Member

cliffhall commented Jul 7, 2025

BTW, you can also test this with the latest version of the getResourceLinks tool of the Everything server.

@cliffhall cliffhall added the waiting on submitter Waiting for the submitter to provide more info label Jul 7, 2025
@nandsha
Copy link
Contributor Author

nandsha commented Jul 8, 2025

Thanks for the great feedback! Working on the refinements, making use of the latest Everything server.

@nandsha
Copy link
Contributor Author

nandsha commented Jul 9, 2025

Extended the initial Resource Link support with a more comprehensive implementation that addresses @cliffhall's suggestions (alternative approach) for enhanced link functionality. Resource links now send resources/read requests when clicked, and the content appears inline directly in the tool results using JsonView component.

resource_link_view.mov

@nandsha
Copy link
Contributor Author

nandsha commented Jul 9, 2025

In addition, added test coverage for Resource Link. Thanks @cliffhall and @olaservo

Copy link
Member

@cliffhall cliffhall left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

Thanks @nandsha! This was the perfect implementation. 👌

@cliffhall cliffhall merged commit a7539d0 into modelcontextprotocol:main Jul 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting on submitter Waiting for the submitter to provide more info
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inspector reports ToolCallResult with resource link as invalid
4 participants