Recommend this page to a friend! |
Classes of Mohamed Ahmed | Laravel MCP SDK | docs/api/_RootsCapability.md | Download |
|
![]() RootsCapabilityNamespace: `` Represents the roots capability in the MCP system. This class manages information about root directories that are available in the MCP system. It tracks whether the roots feature is enabled and maintains a list of configured root directories. Root Directory Features: - Enable/disable root directory management - Configure multiple root directories - Track root directory paths and metadata - Serialize root configurations Root Directory Configuration:
Example Usage:
@package LaravelMCP\MCP\Capabilities Methods__constructCreate a new roots capability instance. Initializes the roots capability with optional configuration for enabling/disabling root directory management and setting up root directory configurations. Example:
@param bool $enabled Whether the roots capability is enabled @param array $roots List of configured root directories, each containing:
isEnabledCheck if roots capability is enabled. Determines whether root directory management is active in the current MCP system configuration. When disabled, root directory operations will not be available. Example:
@return bool True if roots capability is enabled, false otherwise getRootsGet the configured root directories. Retrieves the list of all configured root directories with their complete configurations, including paths, names, permissions, and metadata. Example:
@return array List of root directory configurations, each containing:
toArrayConvert the capability to an array format. Transforms the roots capability configuration into a structured array suitable for storage or transmission. Includes both the enabled state and the complete root directory configurations. Example output:
@return array The capability data as a key-value array createCreate a new instance from an array of data. Factory method that constructs a RootsCapability instance from a configuration array. This is useful for deserializing stored configurations or processing API responses. Example:
@param array $data The data to create the instance from, containing:
@return static A new instance of the capability |