<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
  <!ENTITY RFC2119 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
  <!ENTITY RFC6241 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml">
  <!ENTITY RFC7595 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7595.xml">
  <!ENTITY RFC7950 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml">
  <!ENTITY RFC8040 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml">
  <!ENTITY RFC8174 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
  <!ENTITY RFC8343 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8343.xml">
]>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="3"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     category="info"
     docName="draft-feng-nmop-naim-mcp-00"
     ipr="trust200902"
     submissionType="IETF"
     consensus="true">
  <front>
    <title abbrev="NAIM over MCP">Implementing the NAIM Framework over the Model Context Protocol</title>
    <author initials="C." surname="Feng" fullname="Chong Feng">
      <address>
        <email>fengchongllly@gmail.com</email>
      </address>
    </author>
    <date year="2026" month="July" day="16"/>
    <area>OPS</area>
    <workgroup>NMOP</workgroup>
    <keyword>NAIM</keyword>
    <keyword>MCP</keyword>
    <keyword>YANG</keyword>
    <keyword>AI</keyword>
    <keyword>network management</keyword>
    <abstract>
      <t>
        NAIM (Natural AI Interface Modeling) is a semantic
        intermediate representation framework for AI-assisted
        network management.  It consists of two specifications:
        a core specification <xref target="NAIM-CORE"/> that
        defines the NAIM Document format, YANG-aware node
        templates, type representation, and design-time Skills
        A-D; and an operations specification
        <xref target="NAIM-OP"/> that defines the Operation IR,
        runtime execution semantics, transaction and compensation
        model, and runtime Skills E-F.
      </t>
      <t>
        The Model Context Protocol (MCP) has emerged as the
        dominant standard for AI hosts to discover and invoke
        external capabilities.  However, MCP delegates semantic
        understanding entirely to the AI model through natural
        language Tool descriptions, which is insufficient for the
        structured precondition checking, constraint validation,
        and compensation logic that reliable network management
        requires.
      </t>
      <t>
        This document specifies how the NAIM framework is
        implemented over MCP.  It defines the Originator/Handler
        architectural split, the MCP Resources through which NAIM
        LLM Context Views are distributed, the minimal MCP Tool
        surface through which Operation IRs are submitted, and the
        complete interaction flow from natural language intent to
        validated network execution.  This document is
        self-contained with respect to the MCP integration
        architecture; it references <xref target="NAIM-CORE"/> and
        <xref target="NAIM-OP"/> for the NAIM Document format,
        Operation IR structure, and execution engine semantics,
        which are not redefined here.
      </t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction" numbered="true" toc="default">
      <name>Introduction</name>

      <section anchor="semantic-gap" numbered="true" toc="default">
        <name>The Semantic Gap in MCP-Based Network Management</name>
        <t>
          YANG <xref target="RFC7950"/> provides precise structural
          modeling for network management, used with NETCONF
          <xref target="RFC6241"/> and RESTCONF
          <xref target="RFC8040"/>.  However, YANG does not express
          operational preconditions, side effects, compensation
          logic, or natural language intent alignment.  When AI
          agents attempt to drive NETCONF operations from natural
          language, these gaps produce systematic failures.
        </t>
        <t>
          The Model Context Protocol <xref target="MCP"/> provides
          ecosystem-wide tool discovery and invocation, but its
          design delegates semantic understanding entirely to the
          AI model.  MCP Tool descriptions are natural language
          strings; the AI system is expected to determine when and
          how to call a tool based on its general understanding,
          without machine-processable semantic constraints.
        </t>
        <t>
          This design is sufficient for simple, stateless
          operations but insufficient for network management,
          which requires:
        </t>
        <ul spacing="normal">
          <li>precondition verification before configuration
            changes;</li>
          <li>constraint validation against YANG type
            systems;</li>
          <li>compensation (undo) logic for failed multi-step
            operations;</li>
          <li>datastore selection and transaction
            coordination; and</li>
          <li>field-level semantic understanding that natural
            language descriptions cannot reliably convey.</li>
        </ul>
        <t>
          The gap is representational, not
          model-quality-dependent.  Even a highly capable language
          model cannot reliably infer from a natural language MCP
          Tool description whether a configuration change requires
          a specific prior device state, whether repeated
          execution is safe, or how to reverse a failed change.
          The information is simply not present.
        </t>
      </section>

      <section anchor="naim-bridge" numbered="true" toc="default">
        <name>NAIM as the Semantic Bridge</name>
        <t>
          NAIM (Natural AI Interface Modeling) bridges this gap by
          providing a semantic intermediate representation between
          natural language intent and YANG/NETCONF/RESTCONF
          execution.  NAIM is defined across two specifications:
        </t>
        <t>
          <xref target="NAIM-CORE"/> defines the design-time
          framework:
        </t>
        <ul spacing="normal">
          <li>The NAIM Document (Canonical JSON) -- a semantic
            intermediate representation capturing network resource
            models with full semantic annotation: node types
            (leaf, leaf-list, container, list, choice/case,
            rpc/action, notification), type systems mapping to
            YANG base types, operational preconditions, side
            effects, visibility conditions (if-feature/when), and
            constraints;</li>
          <li>Dual-format representation: Canonical JSON
            (authoritative) and Markdown View
            (human-reviewable), with round-trip fidelity;</li>
          <li>The YANG path convention (module-name-prefixed
            absolute schema paths);</li>
          <li>Skills A-D: Conversational Modeling,
            Summarization, YANG Generation, and Reverse
            Engineering;</li>
          <li>The Validation-Reflection-Retry mechanism for AI
            output quality control.</li>
        </ul>
        <t>
          <xref target="NAIM-OP"/> defines the runtime framework:
        </t>
        <ul spacing="normal">
          <li>The NAIM Operation IR -- a structured JSON intent
            object (operation, target YANG path with key
            predicates, values, datastore selection,
            precondition_state, compensation);</li>
          <li>Context completeness classes (full, partial,
            skeleton);</li>
          <li>Skills E (conversational intent modeling) and F
            (protocol execution: Operation IR validation,
            precondition verification via device read, NETCONF
            XML / RESTCONF request compilation, execution, and
            compensation);</li>
          <li>Datastore selection rules, soft constraints,
            transaction and compensation model;</li>
          <li>Dry-run execution preview semantics.</li>
        </ul>
      </section>

      <section anchor="scope" numbered="true" toc="default">
        <name>Scope of This Document</name>
        <t>
          This document specifies how the NAIM framework is
          implemented over MCP.  It covers:
        </t>
        <ul spacing="normal">
          <li>The Originator/Handler architectural decomposition
            and trust boundary
            (<xref target="orig-handler"/>);</li>
          <li>The NAIM Handler's role as an MCP Server
            (<xref target="handler-server"/>);</li>
          <li>MCP Resources for NAIM LLM Context View
            distribution
            (<xref target="mcp-resources"/>);</li>
          <li>MCP Tools for Operation IR submission
            (<xref target="mcp-tools"/>);</li>
          <li>MCP Prompts for NAIM Skill invocation
            (<xref target="mcp-prompts"/>);</li>
          <li>The complete MCP interaction flow
            (<xref target="mcp-flow"/>);</li>
          <li>Information segregation principles
            (<xref target="info-segregation"/>);</li>
          <li>Open issues in MCP protocol design
            (<xref target="open-issues"/>);</li>
          <li>MCP-specific security considerations
            (<xref target="security"/>).</li>
        </ul>
        <t>
          This document does NOT define the NAIM Document format,
          node templates, YANG generation rules, Operation IR
          structure, or execution engine -- these are defined in
          <xref target="NAIM-CORE"/> and <xref target="NAIM-OP"/>.
        </t>
      </section>
    </section>

    <section anchor="req-lang" numbered="true" toc="default">
      <name>Requirements Language</name>
      <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
        "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",
        "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document
        are to be interpreted as described in BCP 14
        <xref target="RFC2119"/> <xref target="RFC8174"/> when,
        and only when, they appear in all capitals, as shown here.
      </t>
    </section>

    <section anchor="terminology" numbered="true" toc="default">
      <name>Terminology</name>
      <dl newline="false" spacing="normal">
        <dt>YANG:</dt>
        <dd>The data modeling language
          <xref target="RFC7950"/>.</dd>
        <dt>NETCONF:</dt>
        <dd>Network Configuration Protocol
          <xref target="RFC6241"/>.</dd>
        <dt>RESTCONF:</dt>
        <dd>REST-based network configuration protocol
          <xref target="RFC8040"/>.</dd>
        <dt>MCP:</dt>
        <dd>Model Context Protocol <xref target="MCP"/>.
          A protocol defining how AI hosts discover and invoke
          external tools, resources, and prompts.</dd>
        <dt>NAIM Document:</dt>
        <dd>A structured artifact conforming to the canonical
          JSON schema defined in <xref target="NAIM-CORE"/>.
          A NAIM Document represents the semantics of one YANG
          module or one YANG submodule, including node types,
          type systems, operational preconditions, side effects,
          visibility conditions, and constraints.</dd>
        <dt>Canonical JSON:</dt>
        <dd>The normative primary format of a NAIM Document.
          All deterministic operations operate on Canonical JSON
          as the authoritative internal object.</dd>
        <dt>Operation IR:</dt>
        <dd>Operation Intermediate Representation.  A structured
          JSON object defined in <xref target="NAIM-OP"/> that
          describes a single runtime operation intent, including
          target YANG path, operation type, values, datastore
          selection, precondition state, and compensation.</dd>
        <dt>Originator:</dt>
        <dd>An AI system (typically a large language model) that
          consumes LLM Context Views and produces Operation IRs
          in response to natural language user intent.  The
          Originator is the intent encoder; it is NOT the
          executor.</dd>
        <dt>Handler:</dt>
        <dd>A deterministic software component that consumes NAIM
          Canonical JSON to validate Operation IRs and execute
          them against target network devices via NETCONF or
          RESTCONF.  The Handler is the semantic authority; it
          does NOT interpret natural language.</dd>
        <dt>LLM Context View:</dt>
        <dd>A derived, machine-optimized but human-readable
          Markdown view of a NAIM Document, intended for
          consumption by Originators as prompt context.  Retains
          path, node-type, type, constraints, writable status,
          visibility conditions, and concise description,
          omitting structural boilerplate and execution details
          to reduce token consumption.  Generation rules are
          defined in <xref target="NAIM-CORE"/>.</dd>
      </dl>
    </section>

    <section anchor="orig-handler" numbered="true" toc="default">
      <name>The Originator/Handler Architecture</name>

      <section anchor="arch-rationale" numbered="true"
               toc="default">
        <name>Architectural Rationale</name>
        <t>
          The Originator/Handler split is the foundational
          architectural decomposition for implementing NAIM over
          MCP.  It separates AI-driven intent encoding from
          deterministic execution:
        </t>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
User natural language intent
        |
        v
   Originator (AI)
        | consumes LLM Context View
        |   (via MCP Resources)
        | produces Operation IR
        v
   Handler (deterministic, MCP Server)
        | consumes Canonical JSON (internal)
        | validates Operation IR
        | executes via NETCONF/RESTCONF
        | compensates on failure
        v
   Target Network Device
]]></artwork>
        <t>
          The Originator is an AI system that consumes LLM Context
          Views retrieved through MCP Resources and produces
          Operation IRs.  The Originator's role is intent encoding:
          translating natural language into a structured,
          validatable operation description.
        </t>
        <t>
          The Handler is a deterministic software component that
          consumes the NAIM Canonical JSON document and executes
          Operation IRs against target network devices.  Per
          <xref target="NAIM-OP"/>, the Handler performs
          path-based node lookup, value validation against type
          and constraint definitions, writable-state verification,
          precondition verification via device read, NETCONF XML /
          RESTCONF request compilation, execution, and automatic
          compensation on failure.
        </t>
      </section>

      <section anchor="trust-boundary" numbered="true"
               toc="default">
        <name>Trust Boundary</name>
        <t>
          The split enforces a critical trust boundary:
        </t>
        <ul spacing="normal">
          <li>The AI (Originator) is not trusted for execution
            decisions.  It encodes intent; it does not validate
            or execute.</li>
          <li>The Handler is the semantic authority.  It validates
            all Operation IRs against the NAIM Canonical JSON
            before execution, regardless of the claimed
            source.</li>
          <li>An Operation IR is an untrusted input that the
            Handler validates, not a trusted command that the
            Handler executes.</li>
        </ul>
        <t>
          This trust model is the opposite of conventional MCP
          Tool usage, where the AI model is fully trusted to
          determine which tools to call, in what order, and with
          what parameters.  NAIM constrains the AI to intent
          encoding and preserves deterministic control over
          execution.
        </t>
      </section>

      <section anchor="design-tension" numbered="true"
               toc="default">
        <name>Design Tension with MCP and Its Resolution</name>
        <t>
          A critical design tension exists between MCP's trust
          model and NAIM's trust model:
        </t>
        <ul spacing="normal">
          <li>MCP trusts the AI model to determine which tools to
            call, in what order, with what parameters.  The AI is
            the decision-maker.</li>
          <li>NAIM does not trust the AI model for execution
            decisions.  The Originator is the intent encoder; the
            Handler is the executor.</li>
        </ul>
        <t>
          This tension is resolved by constraining the MCP Tool
          surface: the Handler exposes few, coarse-grained Tools
          (ideally a single execution entry point) rather than
          many fine-grained Tools that the AI could combine
          arbitrarily.  Semantic control remains inside the
          Handler.
        </t>
      </section>

      <section anchor="data-flow" numbered="true" toc="default">
        <name>Data Flow Specification</name>
        <t>
          The following table specifies the format for each data
          flow:
        </t>
        <table>
          <thead>
            <tr>
              <th>Data Flow</th>
              <th>Format</th>
              <th>Rationale</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>NAIM Doc -> Originator</td>
              <td>LLM Context View (Markdown)</td>
              <td>Semantic density; token efficiency</td>
            </tr>
            <tr>
              <td>NAIM Doc -> Handler</td>
              <td>Canonical JSON (internal)</td>
              <td>Machine-parseable; schema-validatable</td>
            </tr>
            <tr>
              <td>Originator -> Handler</td>
              <td>Operation IR (JSON)</td>
              <td>Machine-parseable interface contract</td>
            </tr>
            <tr>
              <td>Handler -> Device</td>
              <td>NETCONF XML / RESTCONF</td>
              <td>Target protocol requirement</td>
            </tr>
            <tr>
              <td>Handler -> Originator</td>
              <td>Natural language summary</td>
              <td>Human-readable result</td>
            </tr>
            <tr>
              <td>Handler -> Audit</td>
              <td>Execution Report (JSON)</td>
              <td>Machine-parseable; auditable</td>
            </tr>
          </tbody>
        </table>
      </section>
    </section>

    <section anchor="handler-server" numbered="true" toc="default">
      <name>NAIM Handler as MCP Server</name>

      <section anchor="handler-overview" numbered="true"
               toc="default">
        <name>Overview</name>
        <t>
          When exposed as an MCP Server, a NAIM Handler implements
          the Originator/Handler architecture defined in
          <xref target="orig-handler"/>: it exposes LLM Context
          Views as MCP Resources and accepts Operation IRs through
          a minimal MCP Tool surface.  The Handler retains all
          semantic authority; the MCP integration is a transport
          and discovery layer.
        </t>
        <t>A NAIM MCP Server MUST:</t>
        <ul spacing="normal">
          <li>expose at least one MCP Resource returning a NAIM
            LLM Context View;</li>
          <li>expose the execute_operation_ir MCP Tool; and</li>
          <li>validate all received Operation IRs against its
            internal NAIM Canonical JSON before execution.</li>
        </ul>
        <t>A NAIM MCP Server SHOULD:</t>
        <ul spacing="normal">
          <li>expose a validate_operation_ir MCP Tool for
            pre-execution validation; and</li>
          <li>expose the Operation IR JSON Schema as an MCP
            Resource.</li>
        </ul>
        <t>A NAIM MCP Server MAY:</t>
        <ul spacing="normal">
          <li>expose a dry_run_operation_ir MCP Tool;</li>
          <li>expose MCP Prompts for NAIM Skill invocation;
            and</li>
          <li>expose multiple resource-specific LLM Context
            Views.</li>
        </ul>
      </section>

      <section anchor="maturity" numbered="true" toc="default">
        <name>Implementation Maturity Prerequisite</name>
        <t>
          MCP integration is RECOMMENDED only after the NAIM core
          is fully implemented and validated -- Operation IR
          validation working end-to-end, and at least one complete
          resource cycle (create/update/delete with compensation)
          validated against a real network device.
        </t>
      </section>
    </section>

    <section anchor="mcp-resources" numbered="true" toc="default">
      <name>MCP Resources: NAIM Context Distribution</name>

      <section anchor="context-resources" numbered="true"
               toc="default">
        <name>LLM Context View Resources</name>
        <t>
          The NAIM Handler exposes NAIM LLM Context Views as MCP
          Resources, enabling Originators to retrieve semantic
          context before generating Operation IRs.
        </t>
        <t>
          The LLM Context View is a derived Markdown format
          defined in <xref target="NAIM-CORE"/>.  It retains
          path, node-type, type, constraints, writable status,
          visibility conditions, and concise description, omitting
          structural boilerplate to reduce token consumption.
        </t>
        <t>Resource URIs:</t>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
naim://{device-id}/{resource-path}
  -> Returns: NAIM LLM Context View (text/markdown)
  -> Content: Semantic description of the resource,
              fields, constraints, preconditions,
              side effects, and operation vocabulary
]]></artwork>
        <t>Example:</t>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
naim://router-1/interfaces/interface
  -> Returns LLM Context View containing:
    - Node: list
      /ietf-interfaces:interfaces/interface
      (key: name)
    - Leaves: name (string, config false),
      enabled (boolean, writable),
      oper-status (enumeration, read-only)
    - Operations: create, update, delete with
      preconditions and side effects
    - Operation IR Schema URI
]]></artwork>
      </section>

      <section anchor="schema-resource" numbered="true"
               toc="default">
        <name>Operation IR Schema Resource</name>
        <t>
          The Handler SHOULD expose the Operation IR JSON Schema
          as an MCP Resource, enabling Originators to
          self-validate before submission:
        </t>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
naim://{device-id}/schema/operation-ir
  -> Returns: JSON Schema for NAIM Operation IR
              (application/json)
  -> Content: The schema that Originators must
              conform to when generating Operation IRs
]]></artwork>
      </section>

      <section anchor="resource-scope" numbered="true"
               toc="default">
        <name>Resource Scope and Granularity</name>
        <t>
          A NAIM MCP Server MAY expose LLM Context Views at
          multiple levels of granularity:
        </t>
        <ul spacing="normal">
          <li>Module-level: A single resource covering all nodes
            in a YANG module.  Suitable for small modules but may
            exceed token budgets for large ones.</li>
          <li>Subtree-level: Resources scoped to specific
            containers or lists.  The RECOMMENDED granularity for
            production use.</li>
          <li>Node-level: Individual node resources.  Fine-grained
            but may require multiple retrievals for a single
            operation.</li>
        </ul>
        <t>
          The Handler SHOULD document its resource granularity in
          the MCP Server manifest.
        </t>
      </section>

      <section anchor="content-req" numbered="true"
               toc="default">
        <name>Content Requirements</name>
        <t>
          The LLM Context View returned by MCP Resources is the
          ONLY format the Originator needs.  The NAIM Canonical
          JSON is an internal Handler artifact and MUST NOT be
          exposed through MCP Resources.
        </t>
        <t>An LLM Context View MUST include:</t>
        <ul spacing="normal">
          <li>resource/node name and type;</li>
          <li>all field names with semantic types,
            required/optional status, constraints, and
            illustrative examples where present;</li>
          <li>supported operation names;</li>
          <li>for each operation: preconditions, side effects, and
            the parameter vocabulary;</li>
          <li>the Operation IR schema reference (URI); and</li>
          <li>any visibility conditions that affect field or
            operation availability.</li>
        </ul>
        <t>An LLM Context View MUST omit:</t>
        <ul spacing="normal">
          <li>NETCONF XML / RESTCONF request construction
            details;</li>
          <li>response parsing details;</li>
          <li>internal metadata (version, organization,
            ownership); and</li>
          <li>raw JSON Schema syntax of the Canonical JSON.</li>
        </ul>
      </section>
    </section>

    <section anchor="mcp-tools" numbered="true" toc="default">
      <name>MCP Tools: Minimal Execution Surface</name>
      <t>
        The NAIM Handler exposes a minimal set of MCP Tools.
        Consistent with the trust boundary defined in
        <xref target="trust-boundary"/>, the RECOMMENDED surface
        consists of a single execution entry point and supporting
        validation/dry-run tools.
      </t>

      <section anchor="tool-execute" numbered="true"
               toc="default">
        <name>execute_operation_ir</name>
        <t>
          The primary execution entry point.  Accepts a complete
          NAIM Operation IR (as defined in
          <xref target="NAIM-OP"/>) and executes it against the
          target network device.
        </t>
        <sourcecode type="json"><![CDATA[
{
  "name": "execute_operation_ir",
  "description": "Execute a validated network
    management operation. Before calling,
    retrieve the relevant resource context from
    naim:// resources to understand field
    constraints, preconditions, and the correct
    Operation IR structure. The Handler validates
    the IR against the NAIM Canonical JSON,
    checks preconditions against the live device,
    executes via NETCONF/RESTCONF, and triggers
    compensation automatically on failure.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "operation_ir": {
        "type": "object",
        "description": "A complete NAIM
          Operation IR object conforming to
          the schema at naim://{device-id}/
          schema/operation-ir."
      }
    },
    "required": ["operation_ir"]
  }
}
]]></sourcecode>
        <t>
          Upon receiving an Operation IR, the Handler performs the
          validation and execution pipeline defined in
          <xref target="NAIM-OP"/> Skill F:
        </t>
        <ol spacing="normal" type="1">
          <li>Locate the target node in the NAIM Canonical JSON
            by path;</li>
          <li>Validate all values fields against type, range,
            pattern, and constraints;</li>
          <li>Verify writable: true for write operations;</li>
          <li>If precondition_state is specified, issue a read to
            the device and verify current state matches declared
            preconditions;</li>
          <li>If validation passes, compile to NETCONF XML or
            RESTCONF request and execute;</li>
          <li>If the primary operation fails and compensation is
            defined, execute compensation operations in
            order.</li>
        </ol>
      </section>

      <section anchor="tool-validate" numbered="true"
               toc="default">
        <name>validate_operation_ir</name>
        <t>
          Validation without execution, supporting Originator
          self-correction.
        </t>
        <sourcecode type="json"><![CDATA[
{
  "name": "validate_operation_ir",
  "description": "Validate a NAIM Operation IR
    without executing it. Returns constraint
    violations, missing fields, and precondition
    evaluation results.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "operation_ir": { "type": "object" },
      "check_preconditions": {
        "type": "boolean",
        "description": "If true, issue a read
          to verify current device state against
          declared preconditions.",
        "default": false
      }
    },
    "required": ["operation_ir"]
  }
}
]]></sourcecode>
        <t>
          When validation fails, the Handler SHOULD return a
          Structured Error Report as defined in
          <xref target="NAIM-CORE"/>, containing error_type,
          field_path, message, and expected format.  This enables
          the Originator to apply the Validation-Reflection-Retry
          mechanism to correct the Operation IR without user
          intervention.
        </t>
      </section>

      <section anchor="tool-dryrun" numbered="true"
               toc="default">
        <name>dry_run_operation_ir (OPTIONAL)</name>
        <t>
          Returns the exact NETCONF XML or RESTCONF request that
          would be sent without executing it.  Supports human
          review before committing to high-risk operations (device
          reload, routing protocol changes, firewall rule
          modifications).
        </t>
        <sourcecode type="json"><![CDATA[
{
  "name": "dry_run_operation_ir",
  "description": "Preview the NETCONF XML or
    RESTCONF request that would be sent for an
    Operation IR, without executing it. Returns
    the rendered protocol messages for human
    review.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "operation_ir": { "type": "object" }
    },
    "required": ["operation_ir"]
  }
}
]]></sourcecode>
        <t>
          This tool corresponds to the dry-run execution mode
          defined in <xref target="NAIM-OP"/> Section 11.
        </t>
      </section>
    </section>

    <section anchor="mcp-prompts" numbered="true" toc="default">
      <name>MCP Prompts (OPTIONAL)</name>
      <t>
        NAIM Skills MAY be exposed as MCP Prompts, enabling MCP
        hosts with Prompt selection UI to surface NAIM workflows.
      </t>

      <section anchor="prompt-execute" numbered="true"
               toc="default">
        <name>Network Intent Execution Prompt</name>
        <sourcecode type="json"><![CDATA[
{
  "name": "execute_network_intent",
  "description": "Execute a natural language
    network management intent with full semantic
    validation and automatic compensation.",
  "arguments": [
    {
      "name": "intent",
      "description": "Natural language
        description of the desired operation",
      "required": true
    },
    {
      "name": "device",
      "description": "Target device identifier",
      "required": false
    },
    {
      "name": "resource",
      "description": "The resource path to
        operate on (e.g., /ietf-interfaces:
        interfaces/interface)",
      "required": false
    }
  ]
}
]]></sourcecode>
      </section>

      <section anchor="prompt-model" numbered="true"
               toc="default">
        <name>NAIM Document Modeling Prompt</name>
        <sourcecode type="json"><![CDATA[
{
  "name": "model_network_resource",
  "description": "Interactively model a network
    resource through structured dialogue,
    producing a NAIM Document. Corresponds to
    NAIM Skill A (Conversational Modeling).",
  "arguments": [
    {
      "name": "resource_description",
      "description": "Natural language
        description of the network resource
        to model",
      "required": true
    }
  ]
}
]]></sourcecode>
      </section>
    </section>

    <section anchor="mcp-flow" numbered="true" toc="default">
      <name>The Complete MCP Interaction Flow</name>
      <t>
        This section illustrates the end-to-end interaction
        between an MCP Host, a NAIM MCP Server, and a target
        network device.
      </t>

      <section anchor="normal-flow" numbered="true"
               toc="default">
        <name>Normal Flow</name>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
Step 1: Context Retrieval
  MCP Host -> resources/read(
    uri="naim://router-1/interfaces/interface")
  NAIM MCP Server ->
    NAIM LLM Context View (text/markdown)
  [Originator now has: field names, types,
   constraints, preconditions for
   create/update/delete, side effects,
   Operation IR vocabulary]

Step 2: Intent Processing
  User: "Disable interface eth0 on router-1"
  Originator (LLM): generates NAIM Operation IR:
  {
    "operation": "update",
    "target": "/ietf-interfaces:interfaces/
      interface[name='eth0']",
    "values": { "enabled": false },
    "context": {
      "datastore": "running",
      "transaction_id": "tx-2026-07-16-001"
    },
    "precondition_state": {
      "/ietf-interfaces:interfaces/
        interface[name='eth0']/oper-status":
          "up"
    },
    "compensation": [
      {
        "operation": "update",
        "target": "/ietf-interfaces:interfaces/
          interface[name='eth0']",
        "values": { "enabled": true },
        "context": { "datastore": "running" }
      }
    ]
  }

Step 3: Validation (OPTIONAL)
  MCP Host -> tools/call(
    name="validate_operation_ir",
    arguments={
      "operation_ir": {...},
      "check_preconditions": true
    })
  NAIM MCP Server -> {
    "valid": true,
    "preconditions": "satisfied",
    "warnings": []
  }

Step 4: Execution
  MCP Host -> tools/call(
    name="execute_operation_ir",
    arguments={ "operation_ir": {...} })
  NAIM Handler:
    - Validates Operation IR against
      NAIM Canonical JSON
    - Issues precondition read to device
    - Confirms oper-status == "up"
    - Compiles NETCONF <edit-config>
      with enabled=false
    - Executes against router-1
    - Returns execution report
  NAIM MCP Server -> {
    "status": "success",
    "summary": "Interface eth0 disabled
      on router-1."
  }

Step 5: Result Communication
  Originator -> User: "Interface eth0 on
    router-1 has been disabled successfully."
]]></artwork>
      </section>

      <section anchor="val-failure-flow" numbered="true"
               toc="default">
        <name>Validation Failure with Self-Correction</name>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
Step 1: Context Retrieval (same as above)

Step 2: Originator generates Operation IR
  with invalid MTU value

Step 3: Validation
  MCP Host -> tools/call(
    name="validate_operation_ir",
    arguments={
      "operation_ir": {
        ... "values": { "mtu": 100000 } ...
      }
    })
  NAIM MCP Server -> {
    "valid": false,
    "errors": [
      {
        "error_type": "constraint_violation",
        "field_path": "/values/mtu",
        "message": "MTU value 100000 exceeds
          allowed range 68..65535.",
        "expected": "Integer in range 68..65535"
      }
    ]
  }

Step 4: Originator applies
  Validation-Reflection-Retry:
  Regenerates Operation IR with corrected
  value (mtu: 9000)

Step 5: Execution with corrected
  Operation IR succeeds
]]></artwork>
      </section>

      <section anchor="comp-flow" numbered="true"
               toc="default">
        <name>Compensation Flow</name>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
Step 1-2: Context retrieval and intent
  processing (same as above)

Step 3: Execution of step 1 in a multi-step
  transaction succeeds

Step 4: Execution of step 2 fails
  NAIM Handler:
    - Detects failure of step 2
    - Automatically executes compensation
      for step 1
    - Returns execution report with
      compensation outcome

Step 5: NAIM MCP Server -> {
    "status": "partial_failure",
    "summary": "Step 2 failed. Step 1 has
      been automatically rolled back via
      compensation.",
    "details": {
      "step_1": { "status": "compensated" },
      "step_2": {
        "status": "failed",
        "error": "..."
      }
    }
  }
]]></artwork>
      </section>
    </section>

    <section anchor="info-segregation" numbered="true"
             toc="default">
      <name>Information Segregation</name>
      <t>
        A NAIM MCP Server deliberately withholds certain
        information from Originator-accessible MCP surfaces.  This
        segregation keeps the AI model in the role of intent
        encoder and removes it from the role of execution
        decision-maker.
      </t>
      <t>
        The following MUST NOT be exposed through MCP Resources or
        Tool responses:
      </t>
      <ul spacing="normal">
        <li>NAIM Canonical JSON: The Handler's authoritative
          representation.  The Originator receives only the LLM
          Context View.</li>
        <li>Device credentials: Managed by the Handler through
          environment variables or secret management, never
          exposed through MCP.</li>
        <li>NETCONF XML / RESTCONF request construction:
          Protocol-specific message generation is a Handler
          concern.  The Originator sees only Operation IRs and
          natural language results.</li>
        <li>Compensation execution internals: Triggered
          automatically by the Handler on failure.  The
          Originator declares compensation intent in the
          Operation IR; the Handler executes it.</li>
        <li>YANG module internals: Import statements, prefix
          mappings, YANG version selection, and namespace
          declarations are Handler concerns.</li>
      </ul>
    </section>

    <section anchor="discouraged" numbered="true" toc="default">
      <name>Discouraged Pattern: Per-Operation Tool Wrapping</name>
      <t>
        An alternative approach -- wrapping each NAIM operation as
        an independent MCP Tool -- is explicitly discouraged:
      </t>
      <artwork name="" type="ascii-art" align="left"><![CDATA[
# Discouraged pattern
MCP Tools:
  create_interface(name, mtu, vlan_id)
    <- no precondition checking
  update_interface(name, mtu, vlan_id)
    <- no constraint validation
  delete_interface(name)
    <- no compensation if caller forgets
]]></artwork>
      <t>
        This pattern degrades NAIM to the semantic level of a
        conventional MCP Tool server.  Precondition checking,
        field constraint validation, and compensation become the
        Originator's responsibility -- a responsibility it cannot
        reliably fulfill given only natural language descriptions.
      </t>
      <t>
        The single-entrypoint pattern (execute_operation_ir)
        preserves the Handler as the semantic authority.  All
        semantic validation, constraint enforcement, precondition
        checking, and compensation logic remain in the
        deterministic Handler, not in the probabilistic AI model.
      </t>
    </section>

    <section anchor="impl-guidance" numbered="true"
             toc="default">
      <name>Implementation Guidance</name>

      <section anchor="impl-sequence" numbered="true"
               toc="default">
        <name>Recommended Sequence</name>
        <t>Implementors SHOULD follow this sequence:</t>
        <dl newline="true" spacing="normal">
          <dt>Phase 1 -- NAIM Core Implementation</dt>
          <dd>Implement the NAIM Document format, Canonical JSON
            validation, Skills A-D, and the NAIM tool layer per
            <xref target="NAIM-CORE"/>.  Validate with a
            well-understood YANG module.</dd>
          <dt>Phase 2 -- Operation IR Implementation</dt>
          <dd>Implement the Operation IR format, validation
            pipeline, precondition checking, NETCONF/RESTCONF
            compilation, and compensation mechanism per
            <xref target="NAIM-OP"/>.  Validate with complete
            resource lifecycles against real devices.</dd>
          <dt>Phase 3 -- MCP Server Integration</dt>
          <dd>Implement the MCP Server wrapper per this document:
            LLM Context View resources, execution and validation
            tools, and optionally Skill-invocation prompts.
            Validate the complete flow with an MCP-compatible
            host.</dd>
          <dt>Phase 4 -- Production Hardening</dt>
          <dd>Implement distributed locking for concurrent
            operation safety, the Validation-Reflection-Retry
            mechanism, Execution Report persistence, and access
            controls.</dd>
        </dl>
      </section>

      <section anchor="multi-device" numbered="true"
               toc="default">
        <name>Multi-Device Deployment</name>
        <t>
          Two deployment models are defined for multi-device
          environments:
        </t>
        <dl newline="true" spacing="normal">
          <dt>Per-device Handler</dt>
          <dd>Each network device is served by a dedicated NAIM
            MCP Server instance.  Provides strict isolation but
            increases management overhead.  RECOMMENDED for
            heterogeneous environments.</dd>
          <dt>Multi-device Handler</dt>
          <dd>A single NAIM MCP Server manages multiple devices,
            distinguishing them by device-id in the resource URI
            scheme.  Reduces management overhead but requires the
            Handler to manage multiple Canonical JSON documents
            and device connections.</dd>
        </dl>
      </section>

      <section anchor="hallucination" numbered="true"
               toc="default">
        <name>Hallucination Mitigation</name>
        <t>
          AI-generated Operation IRs MUST be subject to structural
          validation before execution.  The primary mitigation is
          the Handler's validation pipeline:
        </t>
        <ul spacing="normal">
          <li>All Operation IRs are validated against the NAIM
            Canonical JSON before execution; validation failures
            surface to the Originator for correction.</li>
          <li>The Validation-Reflection-Retry mechanism defined in
            <xref target="NAIM-CORE"/> provides automatic
            self-correction (RECOMMENDED maximum: 3
            retries).</li>
          <li>If retries are exhausted, the system MUST surface
            the error to the user as a targeted natural language
            question.</li>
        </ul>
      </section>
    </section>

    <section anchor="open-issues" numbered="true" toc="default">
      <name>Open Issues: MCP Protocol Considerations</name>
      <t>
        This section identifies open questions in the current MCP
        protocol design that the community may wish to address.
        These observations arise from practical experience
        implementing NAIM over MCP and are offered for community
        discussion, not as normative requirements.
      </t>

      <section anchor="session-lifecycle" numbered="true"
               toc="default">
        <name>Session Lifecycle</name>
        <t>
          MCP does not define an explicit session lifecycle
          mechanism.  There is no protocol-level session
          establishment, capability negotiation at session start,
          or graceful session termination.  Transport-level
          connection state serves as an implicit session proxy,
          but this conflation means:
        </t>
        <ul spacing="normal">
          <li>if the server process restarts, all session state is
            lost silently;</li>
          <li>neither party has a protocol-level mechanism to
            detect that the other party considers the session
            ended; and</li>
          <li>capability changes during a session's lifetime have
            no notification path.</li>
        </ul>
        <t>
          By contrast, NETCONF <xref target="RFC6241"/> defines an
          explicit session model with &lt;hello&gt; exchange,
          capability advertisement, session-id assignment, and
          &lt;close-session&gt; / &lt;kill-session&gt; operations.
          This provides clear lifecycle semantics that both
          endpoints can reason about.
        </t>
        <t>
          This document takes no position on whether MCP should
          adopt a NETCONF-style explicit session model.  However,
          implementors of NAIM MCP Servers SHOULD be aware that
          session state loss may occur without notification and
          SHOULD implement reconnection and state recovery logic
          at the application layer.
        </t>
      </section>

      <section anchor="stateful-servers" numbered="true"
               toc="default">
        <name>Stateful Servers and Cloud-Native Deployment</name>
        <t>
          The current MCP server model maintains transport state
          in server process memory, which creates a one-to-one
          binding between client and server process.  This design
          is incompatible with stateless deployment environments
          (serverless platforms, auto-scaling container
          orchestration) where request routing to a specific
          process instance cannot be guaranteed.
        </t>
        <t>
          Community workarounds include externalizing transport
          state to external stores (e.g., Redis), but these are
          engineering patches applied outside the protocol
          specification rather than protocol-level solutions.
        </t>
        <t>
          It is worth noting that the NAIM Operation IR
          <xref target="NAIM-OP"/> is designed as a self-contained
          object: each Operation IR carries its complete execution
          context (target, values, datastore, precondition_state,
          compensation) without depending on prior request history
          or server-side session state.  This self-containment
          property means that a NAIM Handler's core validation and
          execution logic is inherently stateless -- the Handler
          does not need to maintain cross-request state to
          understand or execute an Operation IR.  Where MCP
          session state management is required, it is confined to
          the MCP transport layer and does not affect the NAIM
          semantic processing layer.
        </t>
      </section>

      <section anchor="semantic-express" numbered="true"
               toc="default">
        <name>Semantic Expressiveness of Tool Descriptions</name>
        <t>
          MCP Tool descriptions are natural language strings with
          no machine-processable semantic structure.  The AI model
          is expected to infer operational semantics --
          preconditions, side effects, idempotency, compensation
          logic, field constraints -- from these descriptions
          alone.
        </t>
        <t>
          For network management, this is a recognized gap: the
          semantics that determine safe execution (constraint
          validation, precondition verification, compensation
          chaining) cannot be reliably inferred from natural
          language.  This gap is the primary motivation for the
          NAIM framework and the Originator/Handler architecture
          defined in this document.
        </t>
        <t>
          The community may wish to consider whether MCP Tool
          descriptions should support optional structured semantic
          annotations alongside natural language descriptions,
          enabling Handlers that implement semantic validation to
          advertise their capabilities in machine-processable
          form.
        </t>
      </section>
    </section>

    <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>

      <section anchor="sec-ir-trust" numbered="true"
               toc="default">
        <name>Operation IR Trust</name>
        <t>
          Operation IRs received through MCP Tools MUST NOT be
          trusted unconditionally.  The Handler MUST perform full
          validation against the NAIM Canonical JSON before
          execution.  The MCP Tool surface is a security boundary:
          any MCP-compatible client can invoke
          execute_operation_ir; the Handler's validation layer is
          the gate.
        </t>
      </section>

      <section anchor="sec-device" numbered="true"
               toc="default">
        <name>Network Device Access Control</name>
        <t>
          NAIM Handlers manage credentials for network devices --
          often the most sensitive systems in an IT
          infrastructure.  Handlers MUST:
        </t>
        <ul spacing="normal">
          <li>support multi-factor authentication for device
            access where available;</li>
          <li>implement least-privilege access: write operations
            SHOULD use credentials scoped to the specific YANG
            subtrees involved;</li>
          <li>log all device authentication events, including
            failures; and</li>
          <li>support credential rotation without Handler
            restart.</li>
        </ul>
      </section>

      <section anchor="sec-exposure" numbered="true"
               toc="default">
        <name>Information Exposure</name>
        <t>
          NAIM LLM Context Views, distributed through MCP
          Resources, contain detailed descriptions of device
          capabilities, field constraints, and operational
          semantics.  This information may be sensitive.  When
          distributed through MCP Resources, access MUST be
          subject to authorization checks equivalent to those
          applied to the underlying YANG models.
        </t>
      </section>

      <section anchor="sec-config" numbered="true"
               toc="default">
        <name>Configuration Change Safety</name>
        <t>
          NAIM Handlers executing configuration changes MUST
          support:
        </t>
        <ul spacing="normal">
          <li>Dry-run mode: For devices supporting it, the Handler
            SHOULD use NETCONF confirmed-commit or equivalent
            mechanisms to enable automatic rollback;</li>
          <li>Change impact preview: Before executing a write
            operation, the Handler SHOULD surface the expected
            configuration delta to the user; and</li>
          <li>Rate limiting: Handlers SHOULD enforce rate limits
            on write operations to prevent accidental
            flooding.</li>
        </ul>
      </section>

      <section anchor="sec-audit" numbered="true"
               toc="default">
        <name>Audit Trail</name>
        <t>
          NAIM Handlers MUST maintain an audit trail of all
          execution events.  For network management specifically,
          the audit trail SHOULD include:
        </t>
        <ul spacing="normal">
          <li>the complete Operation IR as received;</li>
          <li>the exact NETCONF XML or RESTCONF request
            transmitted;</li>
          <li>the device response (with sensitive data
            redacted);</li>
          <li>configuration deltas for write operations;</li>
          <li>precondition verification results; and</li>
          <li>compensation outcomes.</li>
        </ul>
      </section>

      <section anchor="sec-transport" numbered="true"
               toc="default">
        <name>Transport Security</name>
        <t>
          MCP communication between the Host and the NAIM MCP
          Server SHOULD be protected by transport-level security
          mechanisms.  When the MCP Server communicates with
          network devices, it MUST use the secure transport
          mechanisms defined by NETCONF <xref target="RFC6241"/>
          (SSH) or RESTCONF <xref target="RFC8040"/> (TLS).
        </t>
      </section>
    </section>

    <section anchor="iana" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>
        This document requests no IANA actions at this time.
      </t>
      <t>
        If the naim:// URI scheme is adopted for MCP Resource
        identification, a future document may request registration
        with IANA per <xref target="RFC7595"/>.
      </t>
    </section>
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        &RFC2119;
        &RFC6241;
        &RFC7950;
        &RFC8040;
        &RFC8174;
        <reference anchor="NAIM-CORE">
          <front>
            <title>NAIM: A Canonical Data Format for AI-Assisted YANG Modeling</title>
            <author initials="C." surname="Feng"
                    fullname="Chong Feng"/>
            <date/>
          </front>
          <seriesInfo name="Internet-Draft"
                      value="draft-feng-netmod-naim-01"/>
        </reference>
        <reference anchor="NAIM-OP">
          <front>
            <title>Operation Intent Intermediate Representation for Model-Driven Network Execution</title>
            <author initials="C." surname="Feng"
                    fullname="Chong Feng"/>
            <date/>
          </front>
          <seriesInfo name="Internet-Draft"
                      value="draft-feng-netconf-naim-op-00"/>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        &RFC7595;
        &RFC8343;
        <reference anchor="MCP">
          <front>
            <title>Model Context Protocol Specification</title>
            <author>
              <organization>Anthropic</organization>
            </author>
            <date year="2024"/>
          </front>
          <refcontent>
            https://modelcontextprotocol.io/specification
          </refcontent>
        </reference>
      </references>
    </references>

    <section anchor="appendix-a" numbered="false" toc="default">
      <name>MCP Server Manifest Example</name>
      <t>
        The following illustrates how a NAIM Handler describes
        itself to an MCP host:
      </t>
      <sourcecode type="json"><![CDATA[
{
  "name": "naim-handler-router-1",
  "version": "1.0.0",
  "description": "NAIM Handler for router-1.
    Provides semantic-validated network
    management operations via NETCONF.
    Retrieve resource context from naim://
    resources before generating Operation IRs.",
  "resources": [
    {
      "uri": "naim://router-1/interfaces/
        interface",
      "name": "Interface Resource Context",
      "description": "Semantic model for network
        interface management including fields,
        constraints, operation preconditions,
        and side effects.",
      "mimeType": "text/markdown"
    },
    {
      "uri": "naim://router-1/routing/
        control-plane-protocols",
      "name": "Routing Protocol Resource
        Context",
      "description": "Semantic model for routing
        protocol configuration including OSPF,
        BGP, and static routes.",
      "mimeType": "text/markdown"
    },
    {
      "uri": "naim://router-1/schema/
        operation-ir",
      "name": "Operation IR Schema",
      "description": "JSON Schema defining the
        NAIM Operation IR format accepted by
        execute_operation_ir.",
      "mimeType": "application/json"
    }
  ],
  "tools": [
    {
      "name": "execute_operation_ir",
      "description": "Execute a network
        management operation. Before calling,
        retrieve resource context from naim://
        resources. The Handler validates the IR,
        checks preconditions against the live
        device, executes via NETCONF/RESTCONF,
        and triggers compensation automatically
        on failure.",
      "inputSchema": {
        "type": "object",
        "required": ["operation_ir"],
        "properties": {
          "operation_ir": {
            "type": "object",
            "description": "NAIM Operation IR
              conforming to naim://router-1/
              schema/operation-ir"
          }
        }
      }
    },
    {
      "name": "validate_operation_ir",
      "description": "Validate a NAIM Operation
        IR without executing it. Returns
        constraint violations, missing fields,
        and precondition evaluation results.",
      "inputSchema": {
        "type": "object",
        "required": ["operation_ir"],
        "properties": {
          "operation_ir": {
            "type": "object"
          },
          "check_preconditions": {
            "type": "boolean",
            "default": false
          }
        }
      }
    },
    {
      "name": "dry_run_operation_ir",
      "description": "Preview the NETCONF XML
        that would be sent for an Operation IR,
        without executing it.",
      "inputSchema": {
        "type": "object",
        "required": ["operation_ir"],
        "properties": {
          "operation_ir": {
            "type": "object"
          }
        }
      }
    }
  ],
  "prompts": [
    {
      "name": "execute_network_intent",
      "description": "Execute a natural language
        network management intent with full
        semantic validation and automatic
        compensation.",
      "arguments": [
        {
          "name": "intent",
          "description": "Natural language
            description of the desired
            operation",
          "required": true
        }
      ]
    }
  ]
}
]]></sourcecode>
    </section>

    <section anchor="appendix-b" numbered="false" toc="default">
      <name>LLM Context View Example</name>
      <t>
        The following illustrates the LLM Context View that would
        be returned by the MCP Resource
        naim://router-1/interfaces/interface, derived from a NAIM
        Canonical JSON document modeling the ietf-interfaces module
        <xref target="RFC8343"/>:
      </t>
      <sourcecode type="markdown"><![CDATA[
# Resource: /ietf-interfaces:interfaces/interface

- node-type: list
- key: name
- description: A network interface entry.

## Fields

### name (leaf)
- path: /ietf-interfaces:interfaces/
        interface/name
- type: string (length: 1..255)
- writable: no (list key)
- description: The name of the interface.

### enabled (leaf)
- path: /ietf-interfaces:interfaces/
        interface/enabled
- type: boolean
- writable: yes
- default: true
- description: The desired state of the
  interface.

### oper-status (leaf)
- path: /ietf-interfaces:interfaces/
        interface/oper-status
- type: enumeration [up, down, testing,
        unknown, dormant, notPresent,
        lowerLayerDown]
- writable: no
- description: The current operational state
  of the interface.

### type (leaf)
- path: /ietf-interfaces:interfaces/
        interface/type
- type: identityref
  (base: iana-if-type:iana-interface-type)
- writable: yes
- mandatory: true
- description: The type of the interface.

## Operations

### create
- preconditions: Interface name must not
  already exist.
- side-effects: Allocates system resources
  for the new interface.

### update
- preconditions: Interface must exist.
- side-effects: May cause traffic
  interruption if type or enabled status
  changes.

### delete
- preconditions: Interface must be
  admin-disabled (enabled=false) before
  deletion.
- side-effects: Releases all associated
  resources, removes all sub-interface
  configuration.

## Operation IR Schema
- URI: naim://router-1/schema/operation-ir
]]></sourcecode>
    </section>

    <section anchor="appendix-c" numbered="false" toc="default">
      <name>Operation IR Submission Example</name>
      <t>
        The following shows a complete Operation IR as submitted
        through the execute_operation_ir MCP Tool, corresponding
        to the user intent "Set the MTU of interface eth0 to 9000
        on router-1":
      </t>
      <sourcecode type="json"><![CDATA[
{
  "operation_ir": {
    "operation": "update",
    "target": "/ietf-interfaces:interfaces/
      interface[name='eth0']",
    "values": {
      "mtu": 9000
    },
    "description": "Set MTU to 9000 for
      jumbo frame support",
    "context": {
      "module": "ietf-interfaces",
      "datastore": "running",
      "transaction_id": "tx-2026-07-16-002",
      "context_completeness": "full"
    },
    "precondition_state": {
      "/ietf-interfaces:interfaces/
        interface[name='eth0']/enabled": true
    },
    "compensation": [
      {
        "operation": "update",
        "target": "/ietf-interfaces:interfaces/
          interface[name='eth0']",
        "values": { "mtu": 1500 },
        "description": "Restore default MTU
          on failure",
        "context": { "datastore": "running" }
      }
    ]
  }
}
]]></sourcecode>
      <t>
        The Handler processes this Operation IR as follows:
      </t>
      <ol spacing="normal" type="1">
        <li>Locates /ietf-interfaces:interfaces/interface in the
          Canonical JSON; confirms it is a list keyed by
          name.</li>
        <li>Validates mtu: 9000 against the type constraint
          (uint16, range 68..65535); validation passes.</li>
        <li>Verifies writable: true for the mtu leaf.</li>
        <li>Issues a RESTCONF GET to verify the interface exists
          and enabled == true.</li>
        <li>Compiles and sends the NETCONF
          &lt;edit-config&gt;:</li>
      </ol>
      <sourcecode type="xml"><![CDATA[
<edit-config>
  <target><running/></target>
  <config>
    <interfaces
      xmlns="urn:ietf:params:xml:ns:yang:
        ietf-interfaces">
      <interface>
        <name>eth0</name>
        <mtu>9000</mtu>
      </interface>
    </interfaces>
  </config>
</edit-config>
]]></sourcecode>
      <ol spacing="normal" type="1" start="6">
        <li>On success, returns:</li>
      </ol>
      <sourcecode type="json"><![CDATA[
{
  "status": "success",
  "summary": "MTU for interface eth0 set to
    9000 on router-1.",
  "transaction_id": "tx-2026-07-16-002"
}
]]></sourcecode>
      <ol spacing="normal" type="1" start="7">
        <li>On failure, automatically executes the compensation
          operation (restore MTU to 1500) and reports the
          outcome.</li>
      </ol>
    </section>
  </back>
</rfc>
