list_categories
List category keys and values for resource tagging to enable policy-based management like Flow and disaster recovery.
Instructions
List category keys and their values used for resource tagging. Categories enable policy-based management (Flow, DR, etc.).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | OData filter expression. Example: "key eq 'Environment'" | |
| limit | No | Maximum number of categories to return. Omit to retrieve all (auto-paginates). |
Implementation Reference
- The async handler function that executes the list_categories tool logic. Uses v4 prism API to list categories with optional filter and limit, returning structured category data.
async def handle_list_categories( client: NutanixClient, arguments: dict[str, Any] ) -> dict[str, Any]: """List categories using v4 prism API.""" filter_expr = arguments.get("filter") limit = arguments.get("limit") result = await client.v4_list_all( namespace="prism", path="config/categories", filter=filter_expr, max_results=limit, ) categories = result.get("data", []) metadata = result.get("metadata", {}) return { "count": len(categories), "truncated": metadata.get("truncated", False), "categories": [ { "key": cat.get("key"), "extId": cat.get("extId"), "value": cat.get("value"), "description": cat.get("description"), "type": cat.get("type"), } for cat in categories ], } - The tool definition (name, description, inputSchema) for list_categories, defining 'filter' (string) and 'limit' (integer) as optional input parameters.
{ "name": "list_categories", "description": ( "List category keys and their values used for resource tagging. " "Categories enable policy-based management (Flow, DR, etc.)." ), "inputSchema": { "type": "object", "properties": { "filter": { "type": "string", "description": "OData filter expression. Example: \"key eq 'Environment'\"", }, "limit": { "type": "integer", "description": "Maximum number of categories to return. Omit to retrieve all (auto-paginates).", }, }, }, }, - src/nutanix_mcp/tools/networking.py:292-299 (registration)The NETWORKING_HANDLERS dispatch table mapping 'list_categories' to handle_list_categories, which gets merged into ALL_HANDLERS in server.py.
NETWORKING_HANDLERS: dict[str, Any] = { "list_subnets": handle_list_subnets, "get_subnet": handle_get_subnet, "list_images": handle_list_images, "get_image": handle_get_image, "list_categories": handle_list_categories, "get_category": handle_get_category, } - src/nutanix_mcp/server.py:34-41 (registration)ALL_HANDLERS merges all handler dispatch tables including NETWORKING_HANDLERS, and the call_tool handler dispatches to the function by name.
# Merge all handler dispatch tables ALL_HANDLERS: dict[str, Any] = { **VM_HANDLERS, **CLUSTER_HANDLERS, **PE_HANDLERS, **REPORT_HANDLERS, **NETWORKING_HANDLERS, } - get_all_tools() aggregates tool definitions from all modules including NETWORKING_TOOLS which contains the list_categories schema.
def get_all_tools() -> list[dict]: """Return all registered tool definitions.""" return VM_TOOLS + CLUSTER_TOOLS + PE_TOOLS + REPORT_TOOLS + NETWORKING_TOOLS