Files
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2bd709db63 build(deps): bump github.com/mark3labs/mcp-go from 0.37.0 to 0.43.0 (#5844)
Bumps [github.com/mark3labs/mcp-go](https://github.com/mark3labs/mcp-go) from 0.37.0 to 0.43.0.
- [Release notes](https://github.com/mark3labs/mcp-go/releases)
- [Commits](https://github.com/mark3labs/mcp-go/compare/v0.37.0...v0.43.0)

---
updated-dependencies:
- dependency-name: github.com/mark3labs/mcp-go
  dependency-version: 0.43.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-05 08:17:30 +00:00

33 lines
1004 B
Go

package server
import (
"context"
"errors"
"github.com/mark3labs/mcp-go/mcp"
)
var (
// ErrNoClientSession is returned when there is no active client session in the context
ErrNoClientSession = errors.New("no active client session")
// ErrRootsNotSupported is returned when the session does not support roots
ErrRootsNotSupported = errors.New("session does not support roots")
)
// RequestRoots sends an list roots request to the client.
// The client must have declared roots capability during initialization.
// The session must implement SessionWithRoots to support this operation.
func (s *MCPServer) RequestRoots(ctx context.Context, request mcp.ListRootsRequest) (*mcp.ListRootsResult, error) {
session := ClientSessionFromContext(ctx)
if session == nil {
return nil, ErrNoClientSession
}
// Check if the session supports roots requests
if rootsSession, ok := session.(SessionWithRoots); ok {
return rootsSession.ListRoots(ctx, request)
}
return nil, ErrRootsNotSupported
}