@xano/developer-mcp 1.0.50 → 1.0.52

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.
@@ -42,6 +42,7 @@ const RESERVED_VARIABLES = [
42
42
  "$response",
43
43
  "$output",
44
44
  "$input",
45
+ "$index",
45
46
  "$auth",
46
47
  "$env",
47
48
  "$db",
@@ -111,7 +111,7 @@ $db.table.field // Database field reference (in queries)
111
111
  $this // Current item in loops/maps
112
112
  ```
113
113
 
114
- **Reserved Variables:** The following cannot be used as variable names: `$response`, `$output`, `$input`, `$auth`, `$env`, `$db`, `$this`, `$result`.
114
+ **Reserved Variables:** The following cannot be used as variable names: `$response`, `$output`, `$input`, `$auth`, `$env`, `$db`, `$this`, `$result`, `$index`.
115
115
 
116
116
  ### Type Names
117
117
 
@@ -63,8 +63,8 @@ foreach ($input.items) {
63
63
 
64
64
  // For loop (iterate N times)
65
65
  for (10) {
66
- each as $index {
67
- debug.log { value = $index }
66
+ each as $idx {
67
+ debug.log { value = $idx }
68
68
  }
69
69
  }
70
70
 
@@ -249,7 +249,7 @@ var $msg { value = ($status|to_text) ~ ": " ~ ($data|json_encode) }
249
249
 
250
250
  ## Reserved Variables (Cannot Use)
251
251
 
252
- `$response`, `$output`, `$input`, `$auth`, `$env`, `$db`, `$this`, `$result`
252
+ `$response`, `$output`, `$input`, `$auth`, `$env`, `$db`, `$this`, `$result`, `$index`
253
253
 
254
254
  ## Input Block Syntax
255
255
 
@@ -143,14 +143,14 @@ stack {
143
143
  }
144
144
 
145
145
  // Foreach (array iteration) - no built-in index; count manually if needed
146
- var $index {
146
+ var $idx {
147
147
  value = 0
148
148
  }
149
149
  foreach ($input.items) {
150
150
  each as $item {
151
151
  debug.log { value = $item.name }
152
- debug.log { value = $index }
153
- math.add $index { value = 1 }
152
+ debug.log { value = $idx }
153
+ math.add $idx { value = 1 }
154
154
  }
155
155
  }
156
156
 
@@ -445,21 +445,6 @@ foreach ($items) {
445
445
  }
446
446
  ```
447
447
 
448
- ### Loop with Index
449
-
450
- ```xs
451
- foreach ($items) {
452
- each as $item, $index {
453
- db.add "item" {
454
- data = {
455
- value: $item,
456
- position: $index
457
- }
458
- }
459
- }
460
- }
461
- ```
462
-
463
448
  ---
464
449
 
465
450
  ## Naming Rules
@@ -10,6 +10,36 @@ Essential patterns for XanoScript development. Use this as a quick reference for
10
10
 
11
11
  ## Quick Reference
12
12
 
13
+ ### Variable Access Rules
14
+
15
+ **Inputs must use `$input.fieldname` — no shorthand exists.**
16
+
17
+ Input fields declared in the `input {}` block are only accessible via the `$input` prefix. You cannot reference them as bare variables.
18
+
19
+ ```xs
20
+ input {
21
+ text name
22
+ int age
23
+ }
24
+
25
+ // ❌ Wrong — $name is not defined; inputs live on $input
26
+ var $greeting { value = "Hello, " ~ $name }
27
+
28
+ // ✅ Correct
29
+ var $greeting { value = "Hello, " ~ $input.name }
30
+ var $is_adult { value = $input.age >= 18 }
31
+ ```
32
+
33
+ **Stack variables have an optional `$var.` prefix — both forms are identical.**
34
+
35
+ ```xs
36
+ var $total { value = 100 }
37
+
38
+ // ✅ Both are the same thing
39
+ $var.total // explicit prefix form
40
+ $total // shorthand form (no prefix)
41
+ ```
42
+
13
43
  ### Reserved Variable Names
14
44
 
15
45
  These variable names are reserved and cannot be used:
@@ -24,6 +54,7 @@ These variable names are reserved and cannot be used:
24
54
  | `$db` | Database table reference for queries |
25
55
  | `$this` | Current context reference |
26
56
  | `$result` | Used in reduce operations |
57
+ | `$index` | Reserved for some array operations |
27
58
 
28
59
  ```xs
29
60
  // ❌ Wrong - using reserved variable name
@@ -85,6 +85,29 @@ Working with...
85
85
 
86
86
  ## Quick Reference
87
87
 
88
+ ### Variable Access Prefixes
89
+
90
+ | Prefix | Applies to | Shorthand? |
91
+ |--------|-----------|------------|
92
+ | `$input.field` | Input parameters | No — prefix always required |
93
+ | `$var.field` | Stack variables | Yes — `$field` is identical |
94
+ | `$auth.field` | Auth context | No |
95
+ | `$env.NAME` | Environment variables | No |
96
+ | `$db.table.field` | DB field refs (queries) | No |
97
+
98
+ ```xs
99
+ // ❌ Wrong — input fields are NOT accessible as bare variables
100
+ var $name { value = $name } // undefined; inputs live on $input
101
+
102
+ // ✅ Correct — always use $input for input fields
103
+ var $name { value = $input.name }
104
+
105
+ // ✅ Both are valid for stack variables
106
+ var $total { value = 0 }
107
+ $var.total // explicit
108
+ $total // shorthand — same thing
109
+ ```
110
+
88
111
  ### Operators
89
112
  | Category | Operators |
90
113
  |----------|-----------|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/developer-mcp",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
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",