@xano/developer-mcp 2.2.1-beta.3 → 2.2.2-beta.1

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.
@@ -45,9 +45,9 @@
45
45
  },
46
46
  "syntax/array-filters": {
47
47
  "file": "syntax/array-filters.md",
48
- "description": "Array filters, functional operations, and array functions",
48
+ "description": "Array filters, expression-based higher-order filters (map/filter/reduce), JS lambda filters (lambda_map/lambda_reduce), and array functions",
49
49
  "applyTo": [],
50
- "aliases": ["array", "map", "filter", "reduce", "sort"]
50
+ "aliases": ["array", "map", "filter", "reduce", "sort", "lambda-filters", "lambda_map", "lambda_reduce", "higher-order"]
51
51
  },
52
52
  "syntax/functions": {
53
53
  "file": "syntax/functions.md",
@@ -268,10 +268,22 @@
268
268
  "first": { "file": "syntax.md", "category": "array" },
269
269
  "last": { "file": "syntax.md", "category": "array" },
270
270
  "count": { "file": "syntax.md", "category": "array" },
271
- "map": { "file": "syntax.md", "category": "array" },
272
- "filter": { "file": "syntax.md", "category": "array" },
273
- "find": { "file": "syntax.md", "category": "array" },
274
- "reduce": { "file": "syntax.md", "category": "array" },
271
+ "map": { "file": "syntax/array-filters.md", "category": "array", "arg": "expression" },
272
+ "filter": { "file": "syntax/array-filters.md", "category": "array", "arg": "expression" },
273
+ "find": { "file": "syntax/array-filters.md", "category": "array", "arg": "expression" },
274
+ "findIndex": { "file": "syntax/array-filters.md", "category": "array", "arg": "expression" },
275
+ "some": { "file": "syntax/array-filters.md", "category": "array", "arg": "expression" },
276
+ "every": { "file": "syntax/array-filters.md", "category": "array", "arg": "expression" },
277
+ "reduce": { "file": "syntax/array-filters.md", "category": "array", "arg": "expression" },
278
+ "transform": { "file": "syntax/array-filters.md", "category": "any", "arg": "expression" },
279
+ "lambda": { "file": "syntax/array-filters.md", "category": "any", "arg": "js-code" },
280
+ "lambda_map": { "file": "syntax/array-filters.md", "category": "array", "arg": "js-code" },
281
+ "lambda_filter": { "file": "syntax/array-filters.md", "category": "array", "arg": "js-code" },
282
+ "lambda_some": { "file": "syntax/array-filters.md", "category": "array", "arg": "js-code" },
283
+ "lambda_every": { "file": "syntax/array-filters.md", "category": "array", "arg": "js-code" },
284
+ "lambda_find": { "file": "syntax/array-filters.md", "category": "array", "arg": "js-code" },
285
+ "lambda_findIndex": { "file": "syntax/array-filters.md", "category": "array", "arg": "js-code" },
286
+ "lambda_reduce": { "file": "syntax/array-filters.md", "category": "array", "arg": "js-code" },
275
287
  "push": { "file": "syntax.md", "category": "array" },
276
288
  "pop": { "file": "syntax.md", "category": "array" },
277
289
  "join": { "file": "syntax.md", "category": "array" },
@@ -330,6 +330,8 @@ api.lambda {
330
330
  | `code` | string | Code to execute (required) |
331
331
  | `timeout` | integer | Execution timeout in seconds (optional) |
332
332
 
333
+ For running JS per array element inside a filter pipeline, use the `lambda_*` higher-order filters (`lambda_map`, `lambda_filter`, `lambda_reduce`, ...) — see `xano_xanoscript_docs({ topic: "syntax/array-filters" })`.
334
+
333
335
  ---
334
336
 
335
337
  ## Utilities
@@ -41,7 +41,18 @@ Complete reference for XanoScript array filters, functional operations, and stat
41
41
  ($start..$end) // Dynamic range with variables
42
42
  ```
43
43
 
44
- ### Functional Operations
44
+ ### Higher-Order Filters: Expression vs Lambda (CRITICAL)
45
+
46
+ XanoScript has **two families** of higher-order array filters. They are different filters with different syntax — never mix them:
47
+
48
+ | Family | Filters | Argument | Element var | Accumulator |
49
+ |--------|---------|----------|-------------|-------------|
50
+ | **Expression** | `map`, `filter`, `some`, `every`, `find`, `findIndex`, `reduce` | Inline **XanoScript expression** (no quotes, no `return`) | `$$` (alias `$this`) | `$result` (reduce) |
51
+ | **Lambda (JS)** | `lambda_map`, `lambda_filter`, `lambda_some`, `lambda_every`, `lambda_find`, `lambda_findIndex`, `lambda_reduce` | Quoted **string of JavaScript/TypeScript code** that must `return` a value | `$this` | `$result` (lambda_reduce) |
52
+
53
+ ### Expression-Based Filters
54
+
55
+ The argument is an inline XanoScript expression evaluated per element. Context variables: `$$` (current element, alias `$this`), `$index` (position), `$parent` (whole array), and `$result` (previous result, `reduce` only).
45
56
 
46
57
  ```xs
47
58
  // Map - transform each element
@@ -62,10 +73,71 @@ Complete reference for XanoScript array filters, functional operations, and stat
62
73
  // Every - all elements match?
63
74
  [2,4,6]|every:$$%2==0 // true
64
75
 
65
- // Reduce - accumulate to single value
76
+ // Reduce - accumulate to single value (expression FIRST, initial value LAST)
66
77
  [1,2,3,4]|reduce:$$+$result:0 // 10
67
78
  ```
68
79
 
80
+ `transform` is the single-value sibling — it applies an expression to any value (not per element): `2|transform:$$+3` → `5`.
81
+
82
+ ### Lambda Filters (JavaScript Code)
83
+
84
+ Each `lambda_*` filter takes a **string of JS/TS code** executed in Xano's Lambda runtime (requires Lambda support on the instance). The code must `return` a value. An optional final argument sets a timeout in seconds (default 10). Context variables: `$this` (current element), `$index` (position), `$parent` (whole array), and `$result` (previous result, `lambda_reduce` only).
85
+
86
+ ```xs
87
+ [1,2,3]|lambda_map:"return $this * 2" // [2,4,6]
88
+ [1,2,3,4]|lambda_filter:"return $this % 2" // [1,3]
89
+ [1,2,3]|lambda_some:"return $this > 2" // true
90
+ [2,4,6]|lambda_every:"return $this % 2 === 0" // true
91
+ [1,2,3,8,9]|lambda_find:"return $this === 8" // 8
92
+ [1,2,3,8,9]|lambda_findIndex:"return $this === 8" // 3
93
+
94
+ // lambda_reduce: initial value FIRST, then code (opposite of expression reduce!)
95
+ [1,2,3,4,5]|lambda_reduce:[]:"return [...$result, $this + 1];" // [2,3,4,5,6]
96
+
97
+ // Optional trailing timeout (seconds)
98
+ $items|lambda_map:"return $this * 2":10
99
+ ```
100
+
101
+ The single-value sibling is `lambda` — it runs JS code with `$this` bound to the piped value: `$val|lambda:"return $this.toUpperCase()"`.
102
+
103
+ ### Common Mistakes: Mixing the Two Families
104
+
105
+ ❌ **Wrong — JS syntax in an expression filter:**
106
+ ```xs
107
+ $items|map:"return $this * 2" // map expects an expression, not a JS string
108
+ $items|filter:$this.active === true // === is JS; expressions use ==
109
+ ```
110
+
111
+ ✅ **Correct:**
112
+ ```xs
113
+ $items|map:$$ * 2
114
+ $items|filter:$$.active == true
115
+ ```
116
+
117
+ ❌ **Wrong — expression syntax in a lambda filter:**
118
+ ```xs
119
+ $items|lambda_map:$$.name // lambda_map expects a quoted JS code string
120
+ $items|lambda_filter:"$this > 2" // missing return
121
+ ```
122
+
123
+ ✅ **Correct:**
124
+ ```xs
125
+ $items|lambda_map:"return $this.name"
126
+ $items|lambda_filter:"return $this > 2"
127
+ ```
128
+
129
+ ❌ **Wrong — `reduce` argument order confusion:**
130
+ ```xs
131
+ $nums|reduce:0:$$+$result // expression reduce: expression first, initial last
132
+ $nums|lambda_reduce:"return $result + $this":0 // lambda_reduce: initial first, code second
133
+ ```
134
+
135
+ ✅ **Correct:**
136
+ ```xs
137
+ $nums|reduce:$$+$result:0 // expression: expr, then initial
138
+ $nums|lambda_reduce:0:"return $result + $this" // lambda: initial, then code
139
+ ```
140
+
69
141
  ### Array Element Access: `|get` vs `|slice`
70
142
 
71
143
  > **`|get:N`** returns a **single element** by zero-based index.
@@ -26,7 +26,7 @@ Complete reference for XanoScript expressions, operators, and core filters. For
26
26
 
27
27
  For detailed references on specific filter categories, use:
28
28
  - `xano_xanoscript_docs({ topic: "syntax/string-filters" })` — String filters, regex, encoding, security filters, text functions
29
- - `xano_xanoscript_docs({ topic: "syntax/array-filters" })` — Array filters, functional operations, array functions
29
+ - `xano_xanoscript_docs({ topic: "syntax/array-filters" })` — Array filters, expression vs lambda (JS) higher-order filters, array functions
30
30
  - `xano_xanoscript_docs({ topic: "syntax/functions" })` — Math filters/functions, object functions, bitwise operations
31
31
 
32
32
  **The `guid` field (backend-managed — ignore it):** Any construct may carry a top-level `guid = "..."` (e.g. `guid = "tgGYuUFKbBz4_6DIkDR5hUUCRno"`) — a stable identifier Xano assigns and maintains automatically. **Leave it exactly as-is when editing, omit it when writing new code (the backend adds one on save), and never add, change, or remove one unless explicitly asked.**
@@ -63,7 +63,9 @@ Working with...
63
63
  │ ├── Transform all? → map (filter) or array.map (statement)
64
64
  │ ├── Keep some? → filter (filter) or array.filter (statement)
65
65
  │ ├── Find one? → find (filter) or array.find (statement)
66
- │ ├── Combine? → reduce
66
+ │ ├── Combine? → reduce (expression first, initial last: $arr|reduce:$$+$result:0)
67
+ │ ├── Need JS/TS code instead of an expression? → lambda_map, lambda_filter,
68
+ │ │ lambda_reduce, ... (quoted JS string with return — see syntax/array-filters)
67
69
  │ ├── Reverse? → reverse (NOT available on strings)
68
70
  │ ├── Sort? → sort
69
71
  │ └── Statement-level ops? → See syntax/array-filters topic
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "2.3.0",
3
- "updated": "2026-06-01"
2
+ "version": "2.4.0",
3
+ "updated": "2026-06-10"
4
4
  }
@@ -189,10 +189,12 @@ filter:expr: keep matching — `$arr|filter:$$.active`
189
189
  find:expr: first match — `$arr|find:$$.id == 5`
190
190
  some:expr: any match? — `$arr|some:$$.active`
191
191
  every:expr: all match? — `$arr|every:$$.valid`
192
- reduce:init:expr: accumulate — `$arr|reduce:0:$$ + $$2`
192
+ reduce:expr:init: accumulate — `$arr|reduce:$$ + $result:0` (expression first, initial last)
193
193
  join:delim: array to string — `$arr|join:","`
194
194
  push:val: append — `$arr|push:"new"`
195
195
 
196
+ `map`/`filter`/`some`/`every`/`find`/`findIndex`/`reduce` take inline XanoScript expressions (`$$` = element, `$index`, `$result` in reduce) — NOT JavaScript. For JS code use the lambda variants: `lambda_map`/`lambda_filter`/`lambda_some`/`lambda_every`/`lambda_find`/`lambda_findIndex` take a quoted JS string with `return` (`$arr|lambda_map:"return $this * 2"`); `lambda_reduce` takes the initial value FIRST (`$arr|lambda_reduce:0:"return $result + $this"`). See `syntax/array-filters`.
197
+
196
198
  ### Object Filters
197
199
  get:key: get property — `$obj|get:"key"` or `$obj|get:"key":"default"`
198
200
  set:key:val: set property — `$obj|set:"key":"value"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/developer-mcp",
3
- "version": "2.2.1-beta.3",
3
+ "version": "2.2.2-beta.1",
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",
@@ -61,7 +61,7 @@
61
61
  "license": "MIT",
62
62
  "dependencies": {
63
63
  "@modelcontextprotocol/sdk": "^1.26.0",
64
- "@xano/xanoscript-language-server": "^12.4.0",
64
+ "@xano/xanoscript-language-server": "^12.6.1",
65
65
  "minimatch": "^10.1.2",
66
66
  "zod": "^4.0.0"
67
67
  },
@@ -70,5 +70,8 @@
70
70
  "@types/node": "^22.0.0",
71
71
  "typescript": "^5.9.0",
72
72
  "vitest": "^3.0.0"
73
+ },
74
+ "overrides": {
75
+ "lodash-es": "^4.18.1"
73
76
  }
74
77
  }