Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The server exposes a focused set of tools grouped by workflow. This is the quick
| Device and client lookup | `mist_search_device`, `mist_search_client`, `mist_search_nac_user_macs` | Find devices, clients, guest authorizations, and NAC-related client entries by name, MAC, IP, serial, model, or other filters. |
| Configuration read | `mist_get_configuration_objects`, `mist_get_configuration_object_schema`, `mist_search_device_config_history` | Inspect org or site configuration, discover valid schema fields, and review recent configuration history on devices. |
| Configuration changes | `mist_update_configuration_objects`, `mist_change_configuration_objects` | Create, update, and delete supported configuration objects. These tools require `--enable-write-tools`. |
| Monitoring and events | `mist_search_events`, `mist_search_audit_logs`, `mist_search_alarms`, `mist_get_stats` | Investigate events, audit history, alarms, and operational statistics across organizations, sites, devices, clients, and ports. |
| Monitoring and events | `mist_search_events`, `mist_search_audit_logs`, `mist_get_stats` | Investigate events, audit history, alarms, and operational statistics across organizations, sites, devices, clients, and ports. |
| Assurance and AI insights | `mist_get_sle`, `mist_get_insight_metrics`, `mist_get_site_rrm_info`, `mist_troubleshoot` | Explore SLEs, Mist AI insight metrics, radio resource management state, and Marvis troubleshooting output. |
| Device operations | `mist_utilities`, `mist_list_upgrades` | Run device-side diagnostics and maintenance helpers or inspect upgrade information. Call `mist_utilities` with only `device_type` to list the supported platform-specific utilities. Some state-changing utility actions require write tools, and the disruptive ones also trigger elicitation. |
| Inventory and security context | `mist_get_org_licenses`, `mist_list_rogue_devices` | Review organization license usage and detect or inspect rogue AP activity seen by a site. |
Expand Down
26 changes: 24 additions & 2 deletions mcp_generator/generate_from_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@
REQ_OPTIMIZED_TEMPLATE,
REQ_TEMPLATE,
)
from mcp_generator.templates.tmpl_search_events import (
SEARCH_EVENTS_OPERATION_IDS,
SEARCH_EVENTS_TEMPLATE,
)
from mcp_generator.templates.tmpl_tool_change_configuration_objects import (
CHANGE_CONFIGURATION_OBJECTS_OPERATION_IDS,
CHANGE_CONFIGURATION_OBJECTS_TEMPLATE,
CHANGE_OPERATIONS,
)
from mcp_generator.templates.tmpl_tool_read import TOOL_TEMPLATE_READ
from mcp_generator.templates.tmpl_tool_search_device import (
Expand All @@ -77,6 +80,10 @@
from mcp_generator.templates.tmpl_tool_update_configuration_objects import (
UPDATE_CONFIGURATION_OBJECTS_TEMPLATE,
)
from mcp_generator.templates.tmpl_tool_upgrade import (
TOOL_TEMPLATE_UPGRADE,
UPGRADE_OPERATIONS,
)
from mcp_generator.templates.tmpl_tool_utilities import UTILITIES_TEMPLATE
from mcp_generator.templates.tmpl_tool_write import TOOL_TEMPLATE_WRITE
from mcp_generator.templates.tmpl_tool_write_delete import (
Expand All @@ -99,10 +106,13 @@
SEARCH_CLIENT_OPERATION_IDS,
SEARCH_CLIENT_TEMPLATE,
)
from templates.tmpl_search_events import (
SEARCH_EVENTS_OPERATION_IDS,
SEARCH_EVENTS_TEMPLATE,
)
from templates.tmpl_tool_change_configuration_objects import (
CHANGE_CONFIGURATION_OBJECTS_OPERATION_IDS,
CHANGE_CONFIGURATION_OBJECTS_TEMPLATE,
CHANGE_OPERATIONS,
)
from templates.tmpl_tool_read import TOOL_TEMPLATE_READ
from templates.tmpl_tool_search_device import TOOL_TEMPLATE_SEARCH_DEVICE
Expand Down Expand Up @@ -188,6 +198,18 @@
"tag": "clients",
"operation_ids": SEARCH_CLIENT_OPERATION_IDS,
},
{
"name": "search_events",
"template": SEARCH_EVENTS_TEMPLATE,
"tag": "events",
"operation_ids": SEARCH_EVENTS_OPERATION_IDS,
},
{
"name": "upgrades",
"template": TOOL_TEMPLATE_UPGRADE,
"tag": "utilities_upgrade",
"operation_ids": UPGRADE_OPERATIONS,
},
]
# Global read-only hint for tool generation
READ_ONLY_HINT = True
Expand Down
35 changes: 12 additions & 23 deletions mcp_generator/templates/tmpl_search_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async def search_client(
),
],
org_id: Annotated[UUID, Field(description="""Organization ID""")],
site_id: Annotated[UUID, Field(description="""Site ID""", default=None)],
site_id: Annotated[UUID, Field(description="""Site ID. Required for site_guest, optional for other client types""", default=None)],
Comment thread
tmunzer-AIDE marked this conversation as resolved.
device_mac: Annotated[
str,
Field(
Expand All @@ -99,7 +99,7 @@ async def search_client(
hostname: Annotated[
str,
Field(
description="""Partial / full Client hostname. Use `prefix*` for prefix search or `*substring*` for contains search (e.g. `everest*` and `*rest*` match `my-everest-client`). Suffix-only wildcards (e.g. `*everest`) are not supported. Not applicable for WAN or wired clients or Org/Site Guests""",
description="""Partial / full Client hostname. Use `prefix*` for prefix search or `*substring*` for contains search (e.g. `everest*` and `*rest*` match `my-everest-client`). Suffix-only wildcards (e.g. `*everest`) are not supported. Not applicable for wired clients or Org/Site Guests""",
default=None,
),
],
Expand All @@ -110,13 +110,6 @@ async def search_client(
default=None,
),
],
wlan_id: Annotated[
UUID,
Field(
description="""WLAN ID to filter by. Only applicable for wireless clients and Guests""",
default=None,
),
],
ssid: Annotated[
str,
Field(
Expand Down Expand Up @@ -150,7 +143,7 @@ async def search_client(

logger.debug("Tool search_client called")
logger.debug(
"Input Parameters: client_type: %s, org_id: %s, site_id: %s, device_mac: %s, band: %s, mac: %s, hostname: %s, ip: %s, wlan_id: %s, ssid: %s, text: %s, start: %s, end: %s, limit: %s",
"Input Parameters: client_type: %s, org_id: %s, site_id: %s, device_mac: %s, band: %s, mac: %s, hostname: %s, ip: %s, ssid: %s, text: %s, start: %s, end: %s, limit: %s",
client_type,
org_id,
site_id,
Expand All @@ -159,7 +152,6 @@ async def search_client(
mac,
hostname,
ip,
wlan_id,
ssid,
text,
start,
Expand Down Expand Up @@ -188,11 +180,11 @@ async def search_client(
}
)

if hostname and client_type.value not in ["wireless", "nac"]:
if hostname and client_type.value not in ["wireless", "nac", "wan"]:
raise ToolError(
{
"status_code": 400,
"message": '`hostname` parameter can only be used when `client_type` is in "wireless", "nac".',
"message": '`hostname` parameter can only be used when `client_type` is in "wireless", "nac", "wan".',
}
)

Expand All @@ -204,14 +196,6 @@ async def search_client(
}
)

if wlan_id and client_type.value not in ["wireless", "org_guest", "site_guest"]:
raise ToolError(
{
"status_code": 400,
"message": '`wlan_id` parameter can only be used when `client_type` is in "wireless", "org_guest", "site_guest".',
}
)

if ssid and client_type.value not in [
"wireless",
"org_guest",
Expand Down Expand Up @@ -303,13 +287,19 @@ async def search_client(
apisession,
org_id=str(org_id),
ssid=str(ssid) if ssid else None,
wlan_id=str(wlan_id) if wlan_id else None,
start=str(start) if start else None,
end=str(end) if end else None,
limit=limit,
)
await process_response(response)
case "site_guest":
if not site_id:
raise ToolError(
{
"status_code": 400,
"message": '`site_id` parameter is required when `client_type` is "site_guest".',
}
)
if mac:
response = mistapi.api.v1.sites.guests.getSiteGuestAuthorization(
apisession, site_id=str(site_id), guest_mac=str(mac)
Expand All @@ -320,7 +310,6 @@ async def search_client(
apisession,
site_id=str(site_id),
ssid=str(ssid) if ssid else None,
wlan_id=str(wlan_id) if wlan_id else None,
start=str(start) if start else None,
end=str(end) if end else None,
limit=limit,
Expand Down
Loading
Loading