Documentation
¶
Overview ¶
Package roots provides client workspace discovery via the MCP Roots capability.
Roots is a client-side capability — the client declares workspace directories/files and the server can query them via ServerSession.ListRoots(). The Manager caches current roots per session and provides helpers for workspace-aware operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListClientRoots ¶
ListClientRoots queries the client for its current workspace roots via the tool request's session. Returns nil with no error when the session is unavailable, enabling graceful degradation for clients without roots support.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager caches client-provided roots for a session and provides workspace-aware lookup helpers. Safe for concurrent use.
func (*Manager) FindGitRoot ¶
FindGitRoot scans cached roots for a path that looks like a Git repository root (URI path ends with ".git" or the root name contains "git"/"repo" hints). Returns the URI and true if found, or ("", false) otherwise.
func (*Manager) Refresh ¶
Refresh queries the client for its current roots via the session and caches the result. Returns nil with an empty root list if the client does not support roots or returns an error (graceful degradation).
func (*Manager) SetRootsForTest ¶
SetRootsForTest replaces the cached root list. Exported for use in tests only.