Skip to content

Add client roots addition/removal API and listRoots handler #118

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ptitjes
Copy link

@ptitjes ptitjes commented Jun 17, 2025

This PR add support for adding/removing client roots and handling listRoots requests.

Fixes #106

Motivation and Context

There is currently no APIs to handle roots.

How Has This Been Tested?

I added tests to ClientTest, for:

  • adding and removing roots
  • checking the client receives and handles server's roots list requests
  • checking roots list changed notifications

Breaking Changes

N/A

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

N/A

@ptitjes ptitjes changed the title Add roots addition/removal API and listRoots handler Add client roots addition/removal API and listRoots handler Jun 17, 2025
@ptitjes ptitjes force-pushed the feature/add-client-roots branch from 28fb01d to 7da695a Compare June 17, 2025 10:53
@e5l e5l requested a review from Copilot June 18, 2025 12:26
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds client roots management functionality including APIs to add, remove, and list roots, along with corresponding tests.

  • Introduces new roots management methods (addRoot, addRoots, removeRoot, removeRoots, and sendRootsListChanged) in the Client class.
  • Adds tests to verify roots addition, removal, error throwing when capability is unsupported, and roots list changed notifications.
  • Updates the SDK API definitions with the new methods.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/jvmTest/kotlin/client/ClientTest.kt Added tests to verify clients' roots API operations
src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/Client.kt Implements roots management functionality and internal handlers for listRoots
api/kotlin-sdk.api Updates API definitions to include the new roots methods

@ptitjes ptitjes force-pushed the feature/add-client-roots branch from 7da695a to 3352a68 Compare June 28, 2025 09:46
@ptitjes
Copy link
Author

ptitjes commented Jun 28, 2025

@e5l Hi! I rebased this PR on main. Is there anything else I should do to get this approved and merged?

@ptitjes ptitjes requested a review from e5l June 28, 2025 09:47
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.

Missing client roots definition API
2 participants