Skip to content

Conversation

@heuperman
Copy link
Contributor

Fixes #77

Add a button to the ListPane component that clears loaded items. This will allow the user to clear and reload resources, resource templates, prompts or tools when they expect the available items to have changed.

Motivation and Context

As noted in #77, once items (Resources, Resource Templates, Tools or Prompts) have been loaded they can't be loaded again. When adding resources or making changes to the other functionalities of the server while using the inspector, the available items might change. To load the fresh data currently requires reloading the inspector and setting up the connection again. By adding a button to clear items and any cursor that was set we can reload items without having to reconnect.

How Has This Been Tested?

Tested manually by connecting to some of the example servers with the inspector.

Breaking Changes

No breaking changes.

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

I initially tried a different approach where the original load button would always fetch and replace existing items. Then instead of adding a button to clear items, we could add a "Load more" button at the bottom of the loaded results. However, the way cursors are stored would have to be refactored and I ran into #97.

I think that approach would lead to a better user experience, but would require more changes and some more thinking. So for now I created this PR with the smallest change required to allow users to reload items.

Add a button to the ListPane component that clears loaded items. This
will allow the user to clear and reload resources, resource templates,
prompts or tools when they expect the available items to have changed.
Copy link
Member

@ashwin-ant ashwin-ant left a comment

Choose a reason for hiding this comment

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

Thank you!

@ashwin-ant ashwin-ant merged commit 50640bc into modelcontextprotocol:main Dec 1, 2024
2 checks passed
@heuperman heuperman deleted the add-button-to-clear-items branch December 1, 2024 16:17
IgnacioC44 referenced this pull request in MCPJam/inspector Jun 21, 2025
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.

Can't run "List Resources" a second time

2 participants