arg-examples
Provides sample KQL queries for common Azure Resource Graph scenarios to help users explore Azure environments and analyze resource data.
Instructions
Sample KQL snippets for common scenarios across ARG tables.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | No | Optional topic filter, e.g., 'subscriptions', 'policy', 'advisor', 'health', 'changes', 'resourcegroups' |
Implementation Reference
- src/azure_assistant_mcp/server.py:185-195 (registration)Registration of the "arg-examples" tool including its name, description, and input schema.types.Tool( name="arg-examples", description="Sample KQL snippets for common scenarios across ARG tables.", inputSchema={ "type": "object", "properties": { "topic": {"type": "string", "description": "Optional topic filter, e.g., 'subscriptions', 'policy', 'advisor', 'health', 'changes', 'resourcegroups'"} }, "required": [], }, ),
- The main handler logic for the "arg-examples" tool, which conditionally includes various KQL example functions based on the topic parameter and formats them for output.if name == "arg-examples": topic = (arguments or {}).get("topic", "").strip().lower() examples: List[str] = [] def add(title: str, kql: str) -> None: examples.extend([title, "KQL:", kql, ""]) # blank line after each if not topic or topic in ("subscriptions", "subs"): add("List subscriptions", list_subscriptions_kql()) if not topic or topic in ("resourcegroups", "resource groups", "rg", "tags"): add("Resource groups without tags", untagged_resource_groups_kql()) add("List resource groups", list_resource_groups_kql(limit=50)) if not topic or topic in ("changes", "resourcechanges"): add("Recent resource changes (7d)", resource_changes_recent_kql(days=7)) add("Manual changes (last 30d) — filterable by RG", manual_changes_kql(days=30)) if not topic or topic in ("containerchanges", "resourcecontainerchanges"): add("Recent subscription/resource group changes (30d)", resource_container_changes_recent_kql(days=30)) if not topic or topic in ("advisor", "recommendations"): add("Advisor recommendations (all)", advisor_recommendations_kql()) if not topic or topic in ("health", "incidents"): add("Service/Resource health advisories (recent)", health_advisories_kql()) if not topic or topic in ("policy", "compliance"): add("Non-compliant policy resources", policy_noncompliant_kql()) if not examples: examples = ["No examples matched the topic filter."] header = ["ARG Examples", "", f"Topic filter: {topic or '(none)'}", ""] return [types.TextContent(type="text", text="\n".join(header + examples))]
- Input schema definition for the "arg-examples" tool, specifying an optional 'topic' string parameter.inputSchema={ "type": "object", "properties": { "topic": {"type": "string", "description": "Optional topic filter, e.g., 'subscriptions', 'policy', 'advisor', 'health', 'changes', 'resourcegroups'"} }, "required": [], },