@owine/unifi-network-mcp 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,26 +6,30 @@ const responses_js_1 = require("../utils/responses.js");
6
6
  const query_js_1 = require("../utils/query.js");
7
7
  const safety_js_1 = require("../utils/safety.js");
8
8
  function registerDnsPolicyTools(server, client, readOnly = false) {
9
- server.tool("unifi_list_dns_policies", "List all DNS policies at a site", {
10
- siteId: zod_1.z.string().describe("Site ID"),
11
- offset: zod_1.z
12
- .number()
13
- .int()
14
- .nonnegative()
15
- .optional()
16
- .describe("Number of records to skip (default: 0)"),
17
- limit: zod_1.z
18
- .number()
19
- .int()
20
- .min(1)
21
- .max(200)
22
- .optional()
23
- .describe("Number of records to return (default: 25, max: 200)"),
24
- filter: zod_1.z
25
- .string()
26
- .optional()
27
- .describe("Filter expression"),
28
- }, safety_js_1.READ_ONLY, async ({ siteId, offset, limit, filter }) => {
9
+ server.registerTool("unifi_list_dns_policies", {
10
+ description: "List all DNS policies at a site",
11
+ inputSchema: {
12
+ siteId: zod_1.z.string().describe("Site ID"),
13
+ offset: zod_1.z
14
+ .number()
15
+ .int()
16
+ .nonnegative()
17
+ .optional()
18
+ .describe("Number of records to skip (default: 0)"),
19
+ limit: zod_1.z
20
+ .number()
21
+ .int()
22
+ .min(1)
23
+ .max(200)
24
+ .optional()
25
+ .describe("Number of records to return (default: 25, max: 200)"),
26
+ filter: zod_1.z
27
+ .string()
28
+ .optional()
29
+ .describe("Filter expression"),
30
+ },
31
+ annotations: safety_js_1.READ_ONLY,
32
+ }, async ({ siteId, offset, limit, filter }) => {
29
33
  try {
30
34
  const query = (0, query_js_1.buildQuery)({ offset, limit, filter });
31
35
  const data = await client.get(`/sites/${siteId}/dns/policies${query}`);
@@ -35,10 +39,14 @@ function registerDnsPolicyTools(server, client, readOnly = false) {
35
39
  return (0, responses_js_1.formatError)(err);
36
40
  }
37
41
  });
38
- server.tool("unifi_get_dns_policy", "Get a specific DNS policy by ID", {
39
- siteId: zod_1.z.string().describe("Site ID"),
40
- dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
41
- }, safety_js_1.READ_ONLY, async ({ siteId, dnsPolicyId }) => {
42
+ server.registerTool("unifi_get_dns_policy", {
43
+ description: "Get a specific DNS policy by ID",
44
+ inputSchema: {
45
+ siteId: zod_1.z.string().describe("Site ID"),
46
+ dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
47
+ },
48
+ annotations: safety_js_1.READ_ONLY,
49
+ }, async ({ siteId, dnsPolicyId }) => {
42
50
  try {
43
51
  const data = await client.get(`/sites/${siteId}/dns/policies/${dnsPolicyId}`);
44
52
  return (0, responses_js_1.formatSuccess)(data);
@@ -49,16 +57,20 @@ function registerDnsPolicyTools(server, client, readOnly = false) {
49
57
  });
50
58
  if (readOnly)
51
59
  return;
52
- server.tool("unifi_create_dns_policy", "Create a new DNS policy", {
53
- siteId: zod_1.z.string().describe("Site ID"),
54
- policy: zod_1.z
55
- .record(zod_1.z.string(), zod_1.z.unknown())
56
- .describe("DNS policy configuration (JSON object)"),
57
- dryRun: zod_1.z
58
- .boolean()
59
- .optional()
60
- .describe("Preview this action without executing it"),
61
- }, safety_js_1.WRITE_NOT_IDEMPOTENT, async ({ siteId, policy, dryRun }) => {
60
+ server.registerTool("unifi_create_dns_policy", {
61
+ description: "Create a new DNS policy",
62
+ inputSchema: {
63
+ siteId: zod_1.z.string().describe("Site ID"),
64
+ policy: zod_1.z
65
+ .record(zod_1.z.string(), zod_1.z.unknown())
66
+ .describe("DNS policy configuration (JSON object)"),
67
+ dryRun: zod_1.z
68
+ .boolean()
69
+ .optional()
70
+ .describe("Preview this action without executing it"),
71
+ },
72
+ annotations: safety_js_1.WRITE_NOT_IDEMPOTENT,
73
+ }, async ({ siteId, policy, dryRun }) => {
62
74
  try {
63
75
  if (dryRun)
64
76
  return (0, safety_js_1.formatDryRun)("POST", `/sites/${siteId}/dns/policies`, policy);
@@ -69,17 +81,21 @@ function registerDnsPolicyTools(server, client, readOnly = false) {
69
81
  return (0, responses_js_1.formatError)(err);
70
82
  }
71
83
  });
72
- server.tool("unifi_update_dns_policy", "Update a DNS policy", {
73
- siteId: zod_1.z.string().describe("Site ID"),
74
- dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
75
- policy: zod_1.z
76
- .record(zod_1.z.string(), zod_1.z.unknown())
77
- .describe("DNS policy configuration (JSON object)"),
78
- dryRun: zod_1.z
79
- .boolean()
80
- .optional()
81
- .describe("Preview this action without executing it"),
82
- }, safety_js_1.WRITE, async ({ siteId, dnsPolicyId, policy, dryRun }) => {
84
+ server.registerTool("unifi_update_dns_policy", {
85
+ description: "Update a DNS policy",
86
+ inputSchema: {
87
+ siteId: zod_1.z.string().describe("Site ID"),
88
+ dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
89
+ policy: zod_1.z
90
+ .record(zod_1.z.string(), zod_1.z.unknown())
91
+ .describe("DNS policy configuration (JSON object)"),
92
+ dryRun: zod_1.z
93
+ .boolean()
94
+ .optional()
95
+ .describe("Preview this action without executing it"),
96
+ },
97
+ annotations: safety_js_1.WRITE,
98
+ }, async ({ siteId, dnsPolicyId, policy, dryRun }) => {
83
99
  try {
84
100
  if (dryRun)
85
101
  return (0, safety_js_1.formatDryRun)("PUT", `/sites/${siteId}/dns/policies/${dnsPolicyId}`, policy);
@@ -90,18 +106,22 @@ function registerDnsPolicyTools(server, client, readOnly = false) {
90
106
  return (0, responses_js_1.formatError)(err);
91
107
  }
92
108
  });
93
- server.tool("unifi_delete_dns_policy", "DESTRUCTIVE: Delete a DNS policy", {
94
- siteId: zod_1.z.string().describe("Site ID"),
95
- dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
96
- confirm: zod_1.z
97
- .boolean()
98
- .optional()
99
- .describe("Must be true to execute this destructive action"),
100
- dryRun: zod_1.z
101
- .boolean()
102
- .optional()
103
- .describe("Preview this action without executing it"),
104
- }, safety_js_1.DESTRUCTIVE, async ({ siteId, dnsPolicyId, confirm, dryRun }) => {
109
+ server.registerTool("unifi_delete_dns_policy", {
110
+ description: "DESTRUCTIVE: Delete a DNS policy",
111
+ inputSchema: {
112
+ siteId: zod_1.z.string().describe("Site ID"),
113
+ dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
114
+ confirm: zod_1.z
115
+ .boolean()
116
+ .optional()
117
+ .describe("Must be true to execute this destructive action"),
118
+ dryRun: zod_1.z
119
+ .boolean()
120
+ .optional()
121
+ .describe("Preview this action without executing it"),
122
+ },
123
+ annotations: safety_js_1.DESTRUCTIVE,
124
+ }, async ({ siteId, dnsPolicyId, confirm, dryRun }) => {
105
125
  const guard = (0, safety_js_1.requireConfirmation)(confirm, "This will delete the DNS policy");
106
126
  if (guard)
107
127
  return guard;
@@ -6,26 +6,30 @@ const responses_js_1 = require("../utils/responses.js");
6
6
  const query_js_1 = require("../utils/query.js");
7
7
  const safety_js_1 = require("../utils/safety.js");
8
8
  function registerFirewallTools(server, client, readOnly = false) {
9
- server.tool("unifi_list_firewall_zones", "List all firewall zones at a site", {
10
- siteId: zod_1.z.string().describe("Site ID"),
11
- offset: zod_1.z
12
- .number()
13
- .int()
14
- .nonnegative()
15
- .optional()
16
- .describe("Number of records to skip (default: 0)"),
17
- limit: zod_1.z
18
- .number()
19
- .int()
20
- .min(1)
21
- .max(200)
22
- .optional()
23
- .describe("Number of records to return (default: 25, max: 200)"),
24
- filter: zod_1.z
25
- .string()
26
- .optional()
27
- .describe("Filter expression"),
28
- }, safety_js_1.READ_ONLY, async ({ siteId, offset, limit, filter }) => {
9
+ server.registerTool("unifi_list_firewall_zones", {
10
+ description: "List all firewall zones at a site",
11
+ inputSchema: {
12
+ siteId: zod_1.z.string().describe("Site ID"),
13
+ offset: zod_1.z
14
+ .number()
15
+ .int()
16
+ .nonnegative()
17
+ .optional()
18
+ .describe("Number of records to skip (default: 0)"),
19
+ limit: zod_1.z
20
+ .number()
21
+ .int()
22
+ .min(1)
23
+ .max(200)
24
+ .optional()
25
+ .describe("Number of records to return (default: 25, max: 200)"),
26
+ filter: zod_1.z
27
+ .string()
28
+ .optional()
29
+ .describe("Filter expression"),
30
+ },
31
+ annotations: safety_js_1.READ_ONLY,
32
+ }, async ({ siteId, offset, limit, filter }) => {
29
33
  try {
30
34
  const query = (0, query_js_1.buildQuery)({ offset, limit, filter });
31
35
  const data = await client.get(`/sites/${siteId}/firewall/zones${query}`);
@@ -35,10 +39,14 @@ function registerFirewallTools(server, client, readOnly = false) {
35
39
  return (0, responses_js_1.formatError)(err);
36
40
  }
37
41
  });
38
- server.tool("unifi_get_firewall_zone", "Get a specific firewall zone by ID", {
39
- siteId: zod_1.z.string().describe("Site ID"),
40
- firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
41
- }, safety_js_1.READ_ONLY, async ({ siteId, firewallZoneId }) => {
42
+ server.registerTool("unifi_get_firewall_zone", {
43
+ description: "Get a specific firewall zone by ID",
44
+ inputSchema: {
45
+ siteId: zod_1.z.string().describe("Site ID"),
46
+ firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
47
+ },
48
+ annotations: safety_js_1.READ_ONLY,
49
+ }, async ({ siteId, firewallZoneId }) => {
42
50
  try {
43
51
  const data = await client.get(`/sites/${siteId}/firewall/zones/${firewallZoneId}`);
44
52
  return (0, responses_js_1.formatSuccess)(data);
@@ -47,26 +55,30 @@ function registerFirewallTools(server, client, readOnly = false) {
47
55
  return (0, responses_js_1.formatError)(err);
48
56
  }
49
57
  });
50
- server.tool("unifi_list_firewall_policies", "List all firewall policies at a site", {
51
- siteId: zod_1.z.string().describe("Site ID"),
52
- offset: zod_1.z
53
- .number()
54
- .int()
55
- .nonnegative()
56
- .optional()
57
- .describe("Number of records to skip (default: 0)"),
58
- limit: zod_1.z
59
- .number()
60
- .int()
61
- .min(1)
62
- .max(200)
63
- .optional()
64
- .describe("Number of records to return (default: 25, max: 200)"),
65
- filter: zod_1.z
66
- .string()
67
- .optional()
68
- .describe("Filter expression"),
69
- }, safety_js_1.READ_ONLY, async ({ siteId, offset, limit, filter }) => {
58
+ server.registerTool("unifi_list_firewall_policies", {
59
+ description: "List all firewall policies at a site",
60
+ inputSchema: {
61
+ siteId: zod_1.z.string().describe("Site ID"),
62
+ offset: zod_1.z
63
+ .number()
64
+ .int()
65
+ .nonnegative()
66
+ .optional()
67
+ .describe("Number of records to skip (default: 0)"),
68
+ limit: zod_1.z
69
+ .number()
70
+ .int()
71
+ .min(1)
72
+ .max(200)
73
+ .optional()
74
+ .describe("Number of records to return (default: 25, max: 200)"),
75
+ filter: zod_1.z
76
+ .string()
77
+ .optional()
78
+ .describe("Filter expression"),
79
+ },
80
+ annotations: safety_js_1.READ_ONLY,
81
+ }, async ({ siteId, offset, limit, filter }) => {
70
82
  try {
71
83
  const query = (0, query_js_1.buildQuery)({ offset, limit, filter });
72
84
  const data = await client.get(`/sites/${siteId}/firewall/policies${query}`);
@@ -76,10 +88,14 @@ function registerFirewallTools(server, client, readOnly = false) {
76
88
  return (0, responses_js_1.formatError)(err);
77
89
  }
78
90
  });
79
- server.tool("unifi_get_firewall_policy", "Get a specific firewall policy by ID", {
80
- siteId: zod_1.z.string().describe("Site ID"),
81
- firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
82
- }, safety_js_1.READ_ONLY, async ({ siteId, firewallPolicyId }) => {
91
+ server.registerTool("unifi_get_firewall_policy", {
92
+ description: "Get a specific firewall policy by ID",
93
+ inputSchema: {
94
+ siteId: zod_1.z.string().describe("Site ID"),
95
+ firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
96
+ },
97
+ annotations: safety_js_1.READ_ONLY,
98
+ }, async ({ siteId, firewallPolicyId }) => {
83
99
  try {
84
100
  const data = await client.get(`/sites/${siteId}/firewall/policies/${firewallPolicyId}`);
85
101
  return (0, responses_js_1.formatSuccess)(data);
@@ -88,13 +104,17 @@ function registerFirewallTools(server, client, readOnly = false) {
88
104
  return (0, responses_js_1.formatError)(err);
89
105
  }
90
106
  });
91
- server.tool("unifi_get_firewall_policy_ordering", "Get user-defined firewall policy ordering for a zone pair", {
92
- siteId: zod_1.z.string().describe("Site ID"),
93
- sourceFirewallZoneId: zod_1.z.string().describe("Source firewall zone ID"),
94
- destinationFirewallZoneId: zod_1.z
95
- .string()
96
- .describe("Destination firewall zone ID"),
97
- }, safety_js_1.READ_ONLY, async ({ siteId, sourceFirewallZoneId, destinationFirewallZoneId }) => {
107
+ server.registerTool("unifi_get_firewall_policy_ordering", {
108
+ description: "Get user-defined firewall policy ordering for a zone pair",
109
+ inputSchema: {
110
+ siteId: zod_1.z.string().describe("Site ID"),
111
+ sourceFirewallZoneId: zod_1.z.string().describe("Source firewall zone ID"),
112
+ destinationFirewallZoneId: zod_1.z
113
+ .string()
114
+ .describe("Destination firewall zone ID"),
115
+ },
116
+ annotations: safety_js_1.READ_ONLY,
117
+ }, async ({ siteId, sourceFirewallZoneId, destinationFirewallZoneId }) => {
98
118
  try {
99
119
  const query = `?sourceFirewallZoneId=${encodeURIComponent(sourceFirewallZoneId)}&destinationFirewallZoneId=${encodeURIComponent(destinationFirewallZoneId)}`;
100
120
  const data = await client.get(`/sites/${siteId}/firewall/policies/ordering${query}`);
@@ -106,17 +126,21 @@ function registerFirewallTools(server, client, readOnly = false) {
106
126
  });
107
127
  if (readOnly)
108
128
  return;
109
- server.tool("unifi_create_firewall_zone", "Create a new custom firewall zone", {
110
- siteId: zod_1.z.string().describe("Site ID"),
111
- name: zod_1.z.string().describe("Zone name"),
112
- networkIds: zod_1.z
113
- .array(zod_1.z.string())
114
- .describe("Network IDs to include in this zone"),
115
- dryRun: zod_1.z
116
- .boolean()
117
- .optional()
118
- .describe("Preview this action without executing it"),
119
- }, safety_js_1.WRITE_NOT_IDEMPOTENT, async ({ siteId, name, networkIds, dryRun }) => {
129
+ server.registerTool("unifi_create_firewall_zone", {
130
+ description: "Create a new custom firewall zone",
131
+ inputSchema: {
132
+ siteId: zod_1.z.string().describe("Site ID"),
133
+ name: zod_1.z.string().describe("Zone name"),
134
+ networkIds: zod_1.z
135
+ .array(zod_1.z.string())
136
+ .describe("Network IDs to include in this zone"),
137
+ dryRun: zod_1.z
138
+ .boolean()
139
+ .optional()
140
+ .describe("Preview this action without executing it"),
141
+ },
142
+ annotations: safety_js_1.WRITE_NOT_IDEMPOTENT,
143
+ }, async ({ siteId, name, networkIds, dryRun }) => {
120
144
  try {
121
145
  const body = { name, networkIds };
122
146
  if (dryRun)
@@ -128,18 +152,22 @@ function registerFirewallTools(server, client, readOnly = false) {
128
152
  return (0, responses_js_1.formatError)(err);
129
153
  }
130
154
  });
131
- server.tool("unifi_update_firewall_zone", "Update a firewall zone", {
132
- siteId: zod_1.z.string().describe("Site ID"),
133
- firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
134
- name: zod_1.z.string().describe("Zone name"),
135
- networkIds: zod_1.z
136
- .array(zod_1.z.string())
137
- .describe("Network IDs to include in this zone"),
138
- dryRun: zod_1.z
139
- .boolean()
140
- .optional()
141
- .describe("Preview this action without executing it"),
142
- }, safety_js_1.WRITE, async ({ siteId, firewallZoneId, name, networkIds, dryRun }) => {
155
+ server.registerTool("unifi_update_firewall_zone", {
156
+ description: "Update a firewall zone",
157
+ inputSchema: {
158
+ siteId: zod_1.z.string().describe("Site ID"),
159
+ firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
160
+ name: zod_1.z.string().describe("Zone name"),
161
+ networkIds: zod_1.z
162
+ .array(zod_1.z.string())
163
+ .describe("Network IDs to include in this zone"),
164
+ dryRun: zod_1.z
165
+ .boolean()
166
+ .optional()
167
+ .describe("Preview this action without executing it"),
168
+ },
169
+ annotations: safety_js_1.WRITE,
170
+ }, async ({ siteId, firewallZoneId, name, networkIds, dryRun }) => {
143
171
  try {
144
172
  const body = { name, networkIds };
145
173
  if (dryRun)
@@ -151,18 +179,22 @@ function registerFirewallTools(server, client, readOnly = false) {
151
179
  return (0, responses_js_1.formatError)(err);
152
180
  }
153
181
  });
154
- server.tool("unifi_delete_firewall_zone", "DESTRUCTIVE: Delete a custom firewall zone", {
155
- siteId: zod_1.z.string().describe("Site ID"),
156
- firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
157
- confirm: zod_1.z
158
- .boolean()
159
- .optional()
160
- .describe("Must be true to execute this destructive action"),
161
- dryRun: zod_1.z
162
- .boolean()
163
- .optional()
164
- .describe("Preview this action without executing it"),
165
- }, safety_js_1.DESTRUCTIVE, async ({ siteId, firewallZoneId, confirm, dryRun }) => {
182
+ server.registerTool("unifi_delete_firewall_zone", {
183
+ description: "DESTRUCTIVE: Delete a custom firewall zone",
184
+ inputSchema: {
185
+ siteId: zod_1.z.string().describe("Site ID"),
186
+ firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
187
+ confirm: zod_1.z
188
+ .boolean()
189
+ .optional()
190
+ .describe("Must be true to execute this destructive action"),
191
+ dryRun: zod_1.z
192
+ .boolean()
193
+ .optional()
194
+ .describe("Preview this action without executing it"),
195
+ },
196
+ annotations: safety_js_1.DESTRUCTIVE,
197
+ }, async ({ siteId, firewallZoneId, confirm, dryRun }) => {
166
198
  const guard = (0, safety_js_1.requireConfirmation)(confirm, "This will delete the firewall zone");
167
199
  if (guard)
168
200
  return guard;
@@ -176,16 +208,20 @@ function registerFirewallTools(server, client, readOnly = false) {
176
208
  return (0, responses_js_1.formatError)(err);
177
209
  }
178
210
  });
179
- server.tool("unifi_create_firewall_policy", "Create a new firewall policy", {
180
- siteId: zod_1.z.string().describe("Site ID"),
181
- policy: zod_1.z
182
- .record(zod_1.z.string(), zod_1.z.unknown())
183
- .describe("Firewall policy configuration (JSON object)"),
184
- dryRun: zod_1.z
185
- .boolean()
186
- .optional()
187
- .describe("Preview this action without executing it"),
188
- }, safety_js_1.WRITE_NOT_IDEMPOTENT, async ({ siteId, policy, dryRun }) => {
211
+ server.registerTool("unifi_create_firewall_policy", {
212
+ description: "Create a new firewall policy",
213
+ inputSchema: {
214
+ siteId: zod_1.z.string().describe("Site ID"),
215
+ policy: zod_1.z
216
+ .record(zod_1.z.string(), zod_1.z.unknown())
217
+ .describe("Firewall policy configuration (JSON object)"),
218
+ dryRun: zod_1.z
219
+ .boolean()
220
+ .optional()
221
+ .describe("Preview this action without executing it"),
222
+ },
223
+ annotations: safety_js_1.WRITE_NOT_IDEMPOTENT,
224
+ }, async ({ siteId, policy, dryRun }) => {
189
225
  try {
190
226
  if (dryRun)
191
227
  return (0, safety_js_1.formatDryRun)("POST", `/sites/${siteId}/firewall/policies`, policy);
@@ -196,17 +232,21 @@ function registerFirewallTools(server, client, readOnly = false) {
196
232
  return (0, responses_js_1.formatError)(err);
197
233
  }
198
234
  });
199
- server.tool("unifi_update_firewall_policy", "Update a firewall policy", {
200
- siteId: zod_1.z.string().describe("Site ID"),
201
- firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
202
- policy: zod_1.z
203
- .record(zod_1.z.string(), zod_1.z.unknown())
204
- .describe("Firewall policy configuration (JSON object)"),
205
- dryRun: zod_1.z
206
- .boolean()
207
- .optional()
208
- .describe("Preview this action without executing it"),
209
- }, safety_js_1.WRITE, async ({ siteId, firewallPolicyId, policy, dryRun }) => {
235
+ server.registerTool("unifi_update_firewall_policy", {
236
+ description: "Update a firewall policy",
237
+ inputSchema: {
238
+ siteId: zod_1.z.string().describe("Site ID"),
239
+ firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
240
+ policy: zod_1.z
241
+ .record(zod_1.z.string(), zod_1.z.unknown())
242
+ .describe("Firewall policy configuration (JSON object)"),
243
+ dryRun: zod_1.z
244
+ .boolean()
245
+ .optional()
246
+ .describe("Preview this action without executing it"),
247
+ },
248
+ annotations: safety_js_1.WRITE,
249
+ }, async ({ siteId, firewallPolicyId, policy, dryRun }) => {
210
250
  try {
211
251
  if (dryRun)
212
252
  return (0, safety_js_1.formatDryRun)("PUT", `/sites/${siteId}/firewall/policies/${firewallPolicyId}`, policy);
@@ -217,17 +257,21 @@ function registerFirewallTools(server, client, readOnly = false) {
217
257
  return (0, responses_js_1.formatError)(err);
218
258
  }
219
259
  });
220
- server.tool("unifi_patch_firewall_policy", "Partially update a firewall policy (e.g. toggle logging)", {
221
- siteId: zod_1.z.string().describe("Site ID"),
222
- firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
223
- policy: zod_1.z
224
- .record(zod_1.z.string(), zod_1.z.unknown())
225
- .describe("Partial firewall policy fields to update (e.g. { loggingEnabled: true })"),
226
- dryRun: zod_1.z
227
- .boolean()
228
- .optional()
229
- .describe("Preview this action without executing it"),
230
- }, safety_js_1.WRITE, async ({ siteId, firewallPolicyId, policy, dryRun }) => {
260
+ server.registerTool("unifi_patch_firewall_policy", {
261
+ description: "Partially update a firewall policy (e.g. toggle logging)",
262
+ inputSchema: {
263
+ siteId: zod_1.z.string().describe("Site ID"),
264
+ firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
265
+ policy: zod_1.z
266
+ .record(zod_1.z.string(), zod_1.z.unknown())
267
+ .describe("Partial firewall policy fields to update (e.g. { loggingEnabled: true })"),
268
+ dryRun: zod_1.z
269
+ .boolean()
270
+ .optional()
271
+ .describe("Preview this action without executing it"),
272
+ },
273
+ annotations: safety_js_1.WRITE,
274
+ }, async ({ siteId, firewallPolicyId, policy, dryRun }) => {
231
275
  try {
232
276
  if (dryRun)
233
277
  return (0, safety_js_1.formatDryRun)("PATCH", `/sites/${siteId}/firewall/policies/${firewallPolicyId}`, policy);
@@ -238,18 +282,22 @@ function registerFirewallTools(server, client, readOnly = false) {
238
282
  return (0, responses_js_1.formatError)(err);
239
283
  }
240
284
  });
241
- server.tool("unifi_delete_firewall_policy", "DESTRUCTIVE: Delete a firewall policy", {
242
- siteId: zod_1.z.string().describe("Site ID"),
243
- firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
244
- confirm: zod_1.z
245
- .boolean()
246
- .optional()
247
- .describe("Must be true to execute this destructive action"),
248
- dryRun: zod_1.z
249
- .boolean()
250
- .optional()
251
- .describe("Preview this action without executing it"),
252
- }, safety_js_1.DESTRUCTIVE, async ({ siteId, firewallPolicyId, confirm, dryRun }) => {
285
+ server.registerTool("unifi_delete_firewall_policy", {
286
+ description: "DESTRUCTIVE: Delete a firewall policy",
287
+ inputSchema: {
288
+ siteId: zod_1.z.string().describe("Site ID"),
289
+ firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
290
+ confirm: zod_1.z
291
+ .boolean()
292
+ .optional()
293
+ .describe("Must be true to execute this destructive action"),
294
+ dryRun: zod_1.z
295
+ .boolean()
296
+ .optional()
297
+ .describe("Preview this action without executing it"),
298
+ },
299
+ annotations: safety_js_1.DESTRUCTIVE,
300
+ }, async ({ siteId, firewallPolicyId, confirm, dryRun }) => {
253
301
  const guard = (0, safety_js_1.requireConfirmation)(confirm, "This will delete the firewall policy");
254
302
  if (guard)
255
303
  return guard;
@@ -263,20 +311,24 @@ function registerFirewallTools(server, client, readOnly = false) {
263
311
  return (0, responses_js_1.formatError)(err);
264
312
  }
265
313
  });
266
- server.tool("unifi_reorder_firewall_policies", "Reorder user-defined firewall policies for a zone pair", {
267
- siteId: zod_1.z.string().describe("Site ID"),
268
- sourceFirewallZoneId: zod_1.z.string().describe("Source firewall zone ID"),
269
- destinationFirewallZoneId: zod_1.z
270
- .string()
271
- .describe("Destination firewall zone ID"),
272
- orderedFirewallPolicyIds: zod_1.z
273
- .record(zod_1.z.string(), zod_1.z.unknown())
274
- .describe("Ordered policy IDs object with beforeSystemDefined and afterSystemDefined arrays"),
275
- dryRun: zod_1.z
276
- .boolean()
277
- .optional()
278
- .describe("Preview this action without executing it"),
279
- }, safety_js_1.WRITE, async ({ siteId, sourceFirewallZoneId, destinationFirewallZoneId, orderedFirewallPolicyIds, dryRun, }) => {
314
+ server.registerTool("unifi_reorder_firewall_policies", {
315
+ description: "Reorder user-defined firewall policies for a zone pair",
316
+ inputSchema: {
317
+ siteId: zod_1.z.string().describe("Site ID"),
318
+ sourceFirewallZoneId: zod_1.z.string().describe("Source firewall zone ID"),
319
+ destinationFirewallZoneId: zod_1.z
320
+ .string()
321
+ .describe("Destination firewall zone ID"),
322
+ orderedFirewallPolicyIds: zod_1.z
323
+ .record(zod_1.z.string(), zod_1.z.unknown())
324
+ .describe("Ordered policy IDs object with beforeSystemDefined and afterSystemDefined arrays"),
325
+ dryRun: zod_1.z
326
+ .boolean()
327
+ .optional()
328
+ .describe("Preview this action without executing it"),
329
+ },
330
+ annotations: safety_js_1.WRITE,
331
+ }, async ({ siteId, sourceFirewallZoneId, destinationFirewallZoneId, orderedFirewallPolicyIds, dryRun, }) => {
280
332
  try {
281
333
  const query = `?sourceFirewallZoneId=${encodeURIComponent(sourceFirewallZoneId)}&destinationFirewallZoneId=${encodeURIComponent(destinationFirewallZoneId)}`;
282
334
  const body = { orderedFirewallPolicyIds };