@xano/developer-mcp 1.0.46 → 1.0.47

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.
@@ -33,21 +33,46 @@ conditional {
33
33
 
34
34
  > **Note:** Use `elseif` (one word), not `else if`.
35
35
 
36
+ ## Switch
37
+
38
+ ```xs
39
+ switch ($input.status) {
40
+ case ("active") {
41
+ var $message { value = "User is active" }
42
+ } break
43
+ case ("pending") {
44
+ var $message { value = "User is pending" }
45
+ } break
46
+ default {
47
+ var $message { value = "Unknown status" }
48
+ }
49
+ }
50
+ ```
51
+
52
+ > **Note:** `break` goes **after** the closing `}` of each `case` block. The `default` case does not need `break`.
53
+
36
54
  ## Loops
37
55
 
38
56
  ```xs
39
57
  // For each loop
40
- each ($input.items as $item) {
41
- debug.log { value = $item.name }
58
+ foreach ($input.items) {
59
+ each as $item {
60
+ debug.log { value = $item.name }
61
+ }
42
62
  }
43
63
 
44
- // While loop (must be inside stack block)
45
- stack {
46
- var $counter { value = 0 }
47
- while ($counter < 10) {
48
- each {
49
- var.update $counter { value = $counter + 1 }
50
- }
64
+ // For loop (iterate N times)
65
+ for (10) {
66
+ each as $index {
67
+ debug.log { value = $index }
68
+ }
69
+ }
70
+
71
+ // While loop
72
+ var $counter { value = 0 }
73
+ while ($counter < 10) {
74
+ each {
75
+ var.update $counter { value = $counter + 1 }
51
76
  }
52
77
  }
53
78
 
@@ -149,25 +149,29 @@ var $content_type { value = $api_result.response.headers|first }
149
149
  var $retries { value = 0 }
150
150
  var $success { value = false }
151
151
 
152
- while ($retries < 3 && $success == false) {
153
- try_catch {
154
- try {
155
- api.request {
156
- url = "https://api.example.com/data"
157
- method = "GET"
158
- timeout = 10
159
- } as $api_result
160
-
161
- conditional {
162
- if ($api_result.response.status == 200) {
163
- var.update $success { value = true }
152
+ stack {
153
+ while ($retries < 3 && $success == false) {
154
+ each {
155
+ try_catch {
156
+ try {
157
+ api.request {
158
+ url = "https://api.example.com/data"
159
+ method = "GET"
160
+ timeout = 10
161
+ } as $api_result
162
+
163
+ conditional {
164
+ if ($api_result.response.status == 200) {
165
+ var.update $success { value = true }
166
+ }
167
+ }
168
+ }
169
+ catch {
170
+ var.update $retries { value = $retries + 1 }
171
+ util.sleep { value = 2 }
164
172
  }
165
173
  }
166
174
  }
167
- catch {
168
- var.update $retries { value = $retries + 1 }
169
- util.sleep { value = 2 }
170
- }
171
175
  }
172
176
  }
173
177
  ```
@@ -286,11 +286,14 @@ For basic rate limiting setup, see `xanoscript_docs({ topic: "security" })`. Bel
286
286
 
287
287
  ```xs
288
288
  // Different limits by user tier
289
- var $limit {
290
- value = conditional {
291
- if ($auth.tier == "premium") { 1000 }
292
- elseif ($auth.tier == "pro") { 500 }
293
- else { 100 }
289
+ var $limit { value = 100 }
290
+
291
+ conditional {
292
+ if ($auth.tier == "premium") {
293
+ var.update $limit { value = 1000 }
294
+ }
295
+ elseif ($auth.tier == "pro") {
296
+ var.update $limit { value = 500 }
294
297
  }
295
298
  }
296
299
 
@@ -150,16 +150,19 @@ conditional {
150
150
 
151
151
  > **Important:** Use `elseif` (one word), not `else if` or `else { if (...) }`. Nested `if` inside `else` blocks is not supported.
152
152
 
153
- ### Conditional as Expression
153
+ ### Conditional with Variable Updates
154
154
 
155
- Use conditional blocks inline to return values:
155
+ Use conditional blocks to update a variable based on conditions:
156
156
 
157
157
  ```xs
158
- var $tier_limit {
159
- value = conditional {
160
- if ($auth.tier == "premium") { 1000 }
161
- elseif ($auth.tier == "pro") { 500 }
162
- else { 100 }
158
+ var $tier_limit { value = 100 }
159
+
160
+ conditional {
161
+ if ($auth.tier == "premium") {
162
+ var.update $tier_limit { value = 1000 }
163
+ }
164
+ elseif ($auth.tier == "pro") {
165
+ var.update $tier_limit { value = 500 }
163
166
  }
164
167
  }
165
168
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/developer-mcp",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "MCP server and library for Xano development - XanoScript validation, Meta API, Run API, and CLI documentation",
5
5
  "type": "module",
6
6
  "main": "dist/lib.js",