Skip to main content
Glama
vespo92

TrueNAS Core MCP Server

create_nfs_export

Create an NFS export on TrueNAS Core for Kubernetes persistent volumes, specifying dataset, allowed networks, read-only access, and root user/group mapping.

Instructions

Create an NFS export for Kubernetes persistent volumes

Args:
    dataset: Dataset path to export (e.g., "tank/k8s-volumes")
    allowed_networks: List of allowed networks (e.g., ["10.0.0.0/24"])
    read_only: Whether the export is read-only
    maproot_user: User to map root to
    maproot_group: Group to map root to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allowed_networksNo
datasetYes
maproot_groupNowheel
maproot_userNoroot
read_onlyNo

Implementation Reference

  • The @tool_handler decorated method that implements the core logic of the create_nfs_export tool. It normalizes the path, sets up export data with API calls to TrueNAS /sharing/nfs endpoint, handles defaults for networks/hosts, and returns structured response with mount example.
    @tool_handler
    async def create_nfs_export(
        self,
        path: str,
        allowed_networks: Optional[List[str]] = None,
        allowed_hosts: Optional[List[str]] = None,
        read_only: bool = False,
        maproot_user: str = "root",
        maproot_group: str = "wheel",
        alldirs: bool = False,
        comment: str = ""
    ) -> Dict[str, Any]:
        """
        Create an NFS export
        
        Args:
            path: Path to export (must exist)
            allowed_networks: List of allowed networks (e.g., ["10.0.0.0/24"])
            allowed_hosts: List of allowed hosts
            read_only: Whether export is read-only
            maproot_user: User to map root to
            maproot_group: Group to map root to
            alldirs: Allow mounting of subdirectories
            comment: Optional comment
            
        Returns:
            Dictionary containing created export information
        """
        await self.ensure_initialized()
        
        # Ensure path starts with /mnt/
        if not path.startswith("/mnt/"):
            path = f"/mnt/{path}"
        
        # Default to allow all if no restrictions specified
        if not allowed_networks and not allowed_hosts:
            allowed_networks = ["0.0.0.0/0"]
        
        export_data = {
            "path": path,
            "comment": comment,
            "ro": read_only,
            "maproot_user": maproot_user,
            "maproot_group": maproot_group,
            "alldirs": alldirs,
            "enabled": True
        }
        
        if allowed_networks:
            export_data["networks"] = allowed_networks
        if allowed_hosts:
            export_data["hosts"] = allowed_hosts
        
        created = await self.client.post("/sharing/nfs", export_data)
        
        # Generate example mount command
        server_ip = str(self.settings.truenas_url).replace("https://", "").replace("http://", "").split(":")[0]
        mount_example = f"mount -t nfs {server_ip}:{path} /local/mount/point"
        
        return {
            "success": True,
            "message": f"NFS export created for path '{path}'",
            "export": {
                "id": created.get("id"),
                "path": created.get("path"),
                "networks": created.get("networks", []),
                "enabled": created.get("enabled")
            },
            "mount_example": mount_example
        }
  • Registration of the create_nfs_export tool within SharingTools.get_tool_definitions() method, including the tool name, handler reference, description, and input schema.
    ("create_nfs_export", self.create_nfs_export, "Create an NFS export",
     {"path": {"type": "string", "required": True},
      "allowed_networks": {"type": "array", "required": False},
      "read_only": {"type": "boolean", "required": False},
      "maproot_user": {"type": "string", "required": False},
      "maproot_group": {"type": "string", "required": False}}),
  • Input schema definition for the create_nfs_export tool, specifying parameter types and requirements as part of the tool registration.
    {"path": {"type": "string", "required": True},
     "allowed_networks": {"type": "array", "required": False},
     "read_only": {"type": "boolean", "required": False},
     "maproot_user": {"type": "string", "required": False},
     "maproot_group": {"type": "string", "required": False}}),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates an NFS export, implying a write operation, but doesn't cover critical aspects like required permissions, whether the export is persistent, potential side effects, error conditions, or response format. This leaves significant gaps for a creation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with a clear purpose statement followed by a parameter list. Every sentence earns its place by adding necessary information, though the parameter section could be slightly more integrated into the flow rather than a separate list.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, no annotations, no output schema), the description is moderately complete. It covers the purpose and parameters well but lacks behavioral details like permissions, side effects, and return values. For a creation tool with no structured support, it should do more to fill these gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds substantial value beyond the input schema, which has 0% schema description coverage. It provides examples for 'dataset' and 'allowed_networks' parameters and clarifies the purpose of 'read_only', 'maproot_user', and 'maproot_group'. This compensates well for the schema's lack of descriptions, though it doesn't cover defaults or all nuances.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create an NFS export') and the resource ('for Kubernetes persistent volumes'), which is specific and informative. However, it doesn't explicitly differentiate this tool from sibling tools like 'create_smb_share' or 'create_iscsi_target', which would require mentioning NFS-specific context or contrasting with other sharing protocols.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'create_smb_share' or 'create_iscsi_target', nor does it mention prerequisites or typical scenarios. It lacks explicit when/when-not instructions or named alternatives, leaving usage context implied at best.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vespo92/TrueNasCoreMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server