Skip to main content
Glama
vespo92

TrueNAS Core MCP Server

create_iscsi_target

Create an iSCSI target for Kubernetes block storage by specifying the target name, dataset for storage, extent size, and portal ID in TrueNAS Core MCP Server.

Instructions

Create an iSCSI target for Kubernetes block storage

Args:
    name: Target name (e.g., "k8s-block-01")
    dataset: Dataset for storing the iSCSI extent
    size: Size of the iSCSI extent (e.g., "100G")
    portal_id: iSCSI portal ID to use

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasetYes
nameYes
portal_idNo
sizeYes

Implementation Reference

  • The main handler function decorated with @tool_handler that executes the create_iscsi_target tool. It generates an IQN, prepares target data, calls the TrueNAS API to create the target, and returns success response with next steps.
    async def create_iscsi_target(
        self,
        name: str,
        alias: Optional[str] = None,
        mode: str = "ISCSI",
        auth_networks: Optional[List[str]] = None
    ) -> Dict[str, Any]:
        """
        Create an iSCSI target
        
        Args:
            name: Target name (will be part of IQN)
            alias: Optional alias for the target
            mode: Target mode (ISCSI or FC)
            auth_networks: List of authorized networks
            
        Returns:
            Dictionary containing created target information
        """
        await self.ensure_initialized()
        
        # Generate IQN
        from datetime import datetime
        year_month = datetime.now().strftime("%Y-%m")
        iqn = f"iqn.{year_month}.com.truenas:{name}"
        
        target_data = {
            "name": iqn,
            "alias": alias or name,
            "mode": mode,
            "groups": []
        }
        
        # Create auth group if networks specified
        if auth_networks:
            # This would require creating an auth group first
            # For now, we'll note this in the response
            pass
        
        created = await self.client.post("/iscsi/target", target_data)
        
        return {
            "success": True,
            "message": f"iSCSI target '{name}' created successfully",
            "target": {
                "id": created.get("id"),
                "iqn": created.get("name"),
                "alias": created.get("alias")
            },
            "next_steps": [
                "Create an extent (LUN) for this target",
                "Map the extent to this target",
                "Configure initiator groups if needed",
                "Enable iSCSI service if not already enabled"
            ]
        }
  • Tool registration within the get_tool_definitions() method of SharingTools class. Registers 'create_iscsi_target' with handler reference, description, and input schema.
        ("list_iscsi_targets", self.list_iscsi_targets, "List all iSCSI targets", {}),
        ("create_iscsi_target", self.create_iscsi_target, "Create an iSCSI target",
         {"name": {"type": "string", "required": True},
          "alias": {"type": "string", "required": False}}),
    ]
  • Input schema definition for the create_iscsi_target tool, specifying required 'name' and optional 'alias' parameters.
    {"name": {"type": "string", "required": True},
     "alias": {"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 full burden for behavioral disclosure. It states this is a creation operation but doesn't mention whether it requires specific permissions, what happens if the target already exists, whether it's idempotent, or what side effects might occur. The description is minimal beyond the basic action.

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

Conciseness5/5

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

The description is efficiently structured with a clear purpose statement followed by parameter explanations in a bullet-like format. Every sentence adds value, with no redundant or unnecessary information. The formatting makes it easy to scan and understand.

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?

For a creation tool with 4 parameters, no annotations, and no output schema, the description provides adequate basic information about what the tool does and what parameters it accepts. However, it lacks important context about behavioral aspects, error conditions, and what the tool returns upon success.

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 provides meaningful explanations for all 4 parameters (name, dataset, size, portal_id) with examples for name and size, adding substantial value beyond the schema which has 0% description coverage. It clarifies what each parameter represents in the context of iSCSI target creation.

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 verb 'Create' and the resource 'iSCSI target for Kubernetes block storage', making the purpose immediately understandable. It distinguishes this tool from siblings like create_dataset or create_nfs_export by specifying it's for iSCSI storage, though it doesn't explicitly contrast with them.

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_dataset or create_smb_share. It doesn't mention prerequisites, dependencies, or typical scenarios for iSCSI target creation in Kubernetes storage contexts.

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