Skip to content

Add getResourceLinks tool to return multiple resource references #2276

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
merged 4 commits into from
Jul 4, 2025

Conversation

ashwin-ant
Copy link
Member

  • Implement new tool that returns configurable number of resource links (1-10)
  • Each link includes URI, name, description, and MIME type from available resources
  • Minor formatting fixes for trailing commas and whitespace

🤖 Generated with Claude Code

Description

Server Details

  • Server: everything
  • Changes to: tools

Motivation and Context

Adds an example of resource links

How Has This Been Tested?

Yes, Claude Code

Breaking Changes

No

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 Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

- Implement new tool that returns configurable number of resource links (1-10)
- Each link includes URI, name, description, and MIME type from available resources
- Minor formatting fixes for trailing commas and whitespace

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@@ -117,7 +127,7 @@ export const createServer = () => {
logging: {},
completions: {},
},
instructions
instructions,

Choose a reason for hiding this comment

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

is it necessary this comma at the end ?

@cliffhall
Copy link
Contributor

cliffhall commented Jul 4, 2025

Hi @ashwin-ant.

This doesn't seem to work as intended.

Screenshot 2025-07-04 at 11 26 51 AM

I do see full content in the response. Maybe the text content entries should be clearer, like "See full tool response for details." And maybe just one of them not bookends?
Screenshot 2025-07-04 at 11 29 52 AM

Copy link
Contributor

@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.

Maybe improve the text content entries (Perhaps just a clearer intro and no outro) for viewing in the Inspector (which is mostly where this server is used).

@ashwin-ant
Copy link
Member Author

@cliffhall I think the issue is that the inspector doesn't currently support the resource_link type since it's fairly new in the spec (only added in the 2025-06-18 update). It still only supports text, image, and resource: https://github.com/modelcontextprotocol/inspector/blob/main/client/src/components/ToolResults.tsx#L179-L204.

We're working on adding resource links to Claude Code, and that's where I've been testing this primarily. I've updated the string to be a bit clearer for the inspector.

@ashwin-ant ashwin-ant requested a review from cliffhall July 4, 2025 16:56
Copy link
Contributor

@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.

formatting

// Add summary text
content.push({
type: "text",
text: `\nThese resource links reference actual resources available through the resources/read endpoint.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the leading newline?
Screenshot 2025-07-04 at 1 36 29 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

And is this final text content even necessary?

@ashwin-ant ashwin-ant force-pushed the ashwin/resourcelinks branch from 09b34c1 to 8dde417 Compare July 4, 2025 17:45
Copy link
Contributor

@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! 👍

@cliffhall cliffhall merged commit 6d64b71 into main Jul 4, 2025
22 checks passed
@cliffhall cliffhall deleted the ashwin/resourcelinks branch July 4, 2025 17:53
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.

3 participants