Skip to content

List SnapMirror Relationships tool fails with "policy field has not been set" error #33

@shashidc44

Description

@shashidc44

Summary
The [List SnapMirror Relationships] tool in the NetApp DataOps Toolkit MCP server fails when attempting to list SnapMirror relationships, throwing an error about a missing policy field.
netapp_dataops_traditional/netapp_dataops/mcp_server/netapp_dataops_ontap_mcp.py

Error Message

[11/17/25 19:30:55] Error calling tool 'List SnapMirror Relationships' ╭────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────╮ │ /Users/shashidc/Developer/dataopsai/.venv/lib/python3.13/site-packages/fastmcp/tools/tool_manager.py:160 in call_tool │ │ │ │ /Users/shashidc/Developer/dataopsai/.venv/lib/python3.13/site-packages/fastmcp/tools/tool.py:333 in run │ │ │ │ ... 1 frames hidden ... │ │ │ │ /Users/shashidc/Developer/dataopsai/.venv/lib/python3.13/site-packages/netapp_dataops/traditional/__init__.py:1346 in │ │ list_snap_mirror_relationships │ │ │ │ 1343 │ │ │ │ # Construct dict containing relationship details │ │ 1344 │ │ │ │ relationshipDict = { │ │ 1345 │ │ │ │ │ "UUID": relationship.uuid, │ │ ❱ 1346 │ │ │ │ │ "Type": relationship.policy.type, │ │ 1347 │ │ │ │ │ "Healthy": healthy, │ │ 1348 │ │ │ │ │ "Current Transfer Status": transferState, │ │ 1349 │ │ │ │ │ "Source Cluster": sourceCluster, │ │ │ │ /Users/shashidc/Developer/dataopsai/.venv/lib/python3.13/site-packages/netapp_ontap/resource.py:355 in __getattribute__ │ │ │ │ 352 │ │ except AttributeError: │ │ 353 │ │ │ schema = super().__getattribute__("_schema_instance") │ │ 354 │ │ │ if name in schema.fields: │ │ ❱ 355 │ │ │ │ raise AttributeError( │ │ 356 │ │ │ │ │ f"The '{name}' field has not been set on the │ │ {super().__getattribute__('__class__').__name__}. " │ │ 357 │ │ │ │ │ f"Try refreshing the object by calling get() or set the field │ │ '{name}'." │ │ 358 │ │ │ │ ) from None │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ AttributeError: The 'policy' field has not been set on the SnapmirrorRelationship. Try refreshing the object by calling get() or set the field 'policy'.

Steps to Reproduce
Set up NetApp DataOps Toolkit MCP server (fastMCP 2.13.1)
Configure connection to ONTAP cluster with valid credentials
Call the [List SnapMirror Relationships] tool
Error occurs consistently

Expected Behavior
The tool should return a list of SnapMirror relationships with their details including UUID, Type, Health status, Transfer Status, Source/Destination information.

Actual Behavior
The tool crashes with a field access error, indicating that the SnapmirrorRelationship object is trying to access a policy field that wasn't fetched during the initial query.

Environment
NetApp DataOps Toolkit: Using MCP server (fastMCP 2.13.1)
ONTAP Version: 9.x
Python Version: 3.13
Transport: stdio

Root Cause Analysis
The tool appears to be querying SnapMirror relationships but not including the policy field in the fields list when fetching the data. When it later tries to access or display the policy information, it fails because the field wasn't populated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions