add idempotentHint to safe-to-retry vCenter tools
Mark tools that handle already-in-target-state gracefully: - storage_vmotion: returns "no_migration_needed" if already on target - convert_to_template: returns "already_template" if already converted - convert_to_vm: returns "already_vm" if already a VM This signals to LLM clients that these operations are safe to retry.
This commit is contained in:
parent
359167ec6a
commit
b9c411fdf9
@ -23,8 +23,8 @@ class VCenterOpsMixin(MCPMixin):
|
|||||||
|
|
||||||
@mcp_tool(
|
@mcp_tool(
|
||||||
name="storage_vmotion",
|
name="storage_vmotion",
|
||||||
description="Move a VM's disks to a different datastore (Storage vMotion)",
|
description="Move a VM's disks to a different datastore (Storage vMotion). Idempotent if already on target.",
|
||||||
annotations=ToolAnnotations(destructiveHint=True),
|
annotations=ToolAnnotations(destructiveHint=True, idempotentHint=True),
|
||||||
)
|
)
|
||||||
def storage_vmotion(
|
def storage_vmotion(
|
||||||
self,
|
self,
|
||||||
@ -161,8 +161,8 @@ class VCenterOpsMixin(MCPMixin):
|
|||||||
|
|
||||||
@mcp_tool(
|
@mcp_tool(
|
||||||
name="convert_to_template",
|
name="convert_to_template",
|
||||||
description="Convert a VM to a template",
|
description="Convert a VM to a template (idempotent - safe to call on existing template)",
|
||||||
annotations=ToolAnnotations(destructiveHint=True),
|
annotations=ToolAnnotations(destructiveHint=True, idempotentHint=True),
|
||||||
)
|
)
|
||||||
def convert_to_template(self, vm_name: str) -> dict[str, Any]:
|
def convert_to_template(self, vm_name: str) -> dict[str, Any]:
|
||||||
"""Convert a VM to a template.
|
"""Convert a VM to a template.
|
||||||
@ -200,8 +200,8 @@ class VCenterOpsMixin(MCPMixin):
|
|||||||
|
|
||||||
@mcp_tool(
|
@mcp_tool(
|
||||||
name="convert_to_vm",
|
name="convert_to_vm",
|
||||||
description="Convert a template back to a VM",
|
description="Convert a template back to a VM (idempotent - safe to call on existing VM)",
|
||||||
annotations=ToolAnnotations(destructiveHint=True),
|
annotations=ToolAnnotations(destructiveHint=True, idempotentHint=True),
|
||||||
)
|
)
|
||||||
def convert_to_vm(
|
def convert_to_vm(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user