list_smb_shares
Identify and display all SMB shares available on the TrueNAS Core MCP Server to manage storage access and sharing configurations efficiently.
Instructions
List all SMB shares
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"title": "list_smb_sharesArguments",
"type": "object"
}
Implementation Reference
- The core handler function for the 'list_smb_shares' tool. It fetches SMB shares from the TrueNAS API (/sharing/smb), extracts and formats key fields into a list of dictionaries, computes metadata statistics, and returns a success response with shares and metadata.@tool_handler async def list_smb_shares(self) -> Dict[str, Any]: """ List all SMB shares Returns: Dictionary containing list of SMB shares """ await self.ensure_initialized() shares = await self.client.get("/sharing/smb") share_list = [] for share in shares: share_info = { "id": share.get("id"), "name": share.get("name"), "path": share.get("path"), "comment": share.get("comment"), "enabled": share.get("enabled", True), "read_only": share.get("ro", False), "browsable": share.get("browsable", True), "guest_ok": share.get("guestok", False), "hosts_allow": share.get("hostsallow", []), "hosts_deny": share.get("hostsdeny", []), "home": share.get("home", False), "timemachine": share.get("timemachine", False), "recyclebin": share.get("recyclebin", False), "audit": share.get("audit", {}) } share_list.append(share_info) return { "success": True, "shares": share_list, "metadata": { "total_shares": len(share_list), "enabled_shares": sum(1 for s in share_list if s["enabled"]), "read_only_shares": sum(1 for s in share_list if s["read_only"]), "guest_shares": sum(1 for s in share_list if s["guest_ok"]), "timemachine_shares": sum(1 for s in share_list if s["timemachine"]) } }
- truenas_mcp_server/tools/sharing.py:16-16 (registration)Local registration of the 'list_smb_shares' tool within the SharingTools.get_tool_definitions() method, specifying the handler function, description, and empty input schema.("list_smb_shares", self.list_smb_shares, "List all SMB shares", {}),
- truenas_mcp_server/server.py:66-69 (registration)Server-level registration includes SharingTools class, which provides the 'list_smb_shares' tool among others, by instantiating tool classes and registering their methods via MCP.tool().UserTools, StorageTools, SharingTools, SnapshotTools