@xano/developer-mcp 1.0.43 → 1.0.45
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.
|
@@ -228,10 +228,14 @@ var $msg { value = ($status|to_text) ~ ": " ~ ($data|json_encode) }
|
|
|
228
228
|
|
|
229
229
|
## Input Block Syntax
|
|
230
230
|
|
|
231
|
+
`?` after the **type** = nullable, `?` after the **variable name** = optional (not required).
|
|
232
|
+
|
|
231
233
|
```xs
|
|
232
234
|
input {
|
|
233
|
-
text name // Required
|
|
234
|
-
text
|
|
235
|
+
text name // Required, not nullable
|
|
236
|
+
text? name // Required, nullable (can send null)
|
|
237
|
+
text name? // Optional (can be omitted)
|
|
238
|
+
text? name? // Optional and nullable
|
|
235
239
|
text role?="user" // Optional with default
|
|
236
240
|
email contact filters=trim // With filters
|
|
237
241
|
text[] tags // Array type
|
|
@@ -83,10 +83,14 @@ Reference with path: `function.run "math/add" { ... }`
|
|
|
83
83
|
|
|
84
84
|
For complete type and filter reference, use `xanoscript_docs({ topic: "types" })`.
|
|
85
85
|
|
|
86
|
+
`?` after the **type** = nullable (`text?`), `?` after the **variable name** = not required (`age?`).
|
|
87
|
+
|
|
86
88
|
```xs
|
|
87
89
|
input {
|
|
88
|
-
text name filters=trim
|
|
89
|
-
|
|
90
|
+
text name filters=trim // Required, not nullable
|
|
91
|
+
text? bio filters=trim // Required, nullable
|
|
92
|
+
int age? filters=min:0 // Optional (not required)
|
|
93
|
+
text? nickname? filters=trim // Optional and nullable
|
|
90
94
|
email contact filters=lower { sensitive = true }
|
|
91
95
|
}
|
|
92
96
|
```
|
|
@@ -138,10 +142,15 @@ stack {
|
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
|
|
141
|
-
// Foreach (array iteration)
|
|
145
|
+
// Foreach (array iteration) - no built-in index; count manually if needed
|
|
146
|
+
var $index {
|
|
147
|
+
value = 0
|
|
148
|
+
}
|
|
142
149
|
foreach ($input.items) {
|
|
143
150
|
each as $item {
|
|
144
151
|
debug.log { value = $item.name }
|
|
152
|
+
debug.log { value = $index }
|
|
153
|
+
math.add $index { value = 1 }
|
|
145
154
|
}
|
|
146
155
|
}
|
|
147
156
|
|
|
@@ -172,13 +172,23 @@ var $message { value = "Status: " ~ ($status|to_text) ~ " - " ~ ($data|json_enco
|
|
|
172
172
|
|
|
173
173
|
> **Full reference:** For complete input types and validation options, see `xanoscript_docs({ topic: "types" })`.
|
|
174
174
|
|
|
175
|
+
The `?` has different meanings depending on placement:
|
|
176
|
+
- **After the type** (`text?`) → **nullable** (value can be `null`)
|
|
177
|
+
- **After the variable name** (`name?`) → **not required** (optional)
|
|
178
|
+
|
|
175
179
|
```xs
|
|
176
180
|
input {
|
|
177
|
-
// Required
|
|
181
|
+
// Required, not nullable
|
|
178
182
|
text name
|
|
179
183
|
|
|
180
|
-
//
|
|
181
|
-
text
|
|
184
|
+
// Required, nullable (caller must provide, but can send null)
|
|
185
|
+
text? name
|
|
186
|
+
|
|
187
|
+
// Optional, not nullable (can be omitted, but if sent must have value)
|
|
188
|
+
text name?
|
|
189
|
+
|
|
190
|
+
// Optional AND nullable (can be omitted or sent as null)
|
|
191
|
+
text? name?
|
|
182
192
|
|
|
183
193
|
// Optional with default value
|
|
184
194
|
text role?="user"
|
|
@@ -186,9 +196,6 @@ input {
|
|
|
186
196
|
// With filters applied
|
|
187
197
|
email contact filters=trim|lower
|
|
188
198
|
|
|
189
|
-
// Optional with default AND filters
|
|
190
|
-
text search?="" filters=trim
|
|
191
|
-
|
|
192
199
|
// Array type
|
|
193
200
|
text[] tags filters=trim
|
|
194
201
|
|
|
@@ -6,7 +6,7 @@ applyTo: "function/**/*.xs, api/**/*.xs, tool/**/*.xs, agent/**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Reference for XanoScript data types, input blocks, and validation.
|
|
8
8
|
|
|
9
|
-
> **TL;DR:** Use `text` not `string`, `int` not `integer`, `bool` not `boolean`.
|
|
9
|
+
> **TL;DR:** Use `text` not `string`, `int` not `integer`, `bool` not `boolean`. `?` after the **type** = nullable (`text?`), `?` after the **variable name** = optional/not required (`name?`). Use `filters=` for validation. Arrays use `type[]` syntax.
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -36,13 +36,21 @@ Reference for XanoScript data types, input blocks, and validation.
|
|
|
36
36
|
| `geo_point` / `geo_polygon` / `geo_linestring` | Geographic data |
|
|
37
37
|
|
|
38
38
|
### Modifiers
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
|
39
|
+
|
|
40
|
+
The `?` has different meanings depending on placement:
|
|
41
|
+
|
|
42
|
+
- **After the type** (`text?`) → the value is **nullable** (can be `null`)
|
|
43
|
+
- **After the variable name** (`name?`) → the value is **not required** (optional)
|
|
44
|
+
|
|
45
|
+
| Syntax | Nullable | Required | Description |
|
|
46
|
+
|--------|----------|----------|-------------|
|
|
47
|
+
| `text name` | No | Yes | Required, cannot be null |
|
|
48
|
+
| `text? name` | Yes | Yes | Required, can be null |
|
|
49
|
+
| `text name?` | No | No | Optional, cannot be null |
|
|
50
|
+
| `text? name?` | Yes | No | Optional, can be null |
|
|
51
|
+
| `text name?="default"` | No | No | Optional with default value |
|
|
52
|
+
| `text[]` | — | — | Array of type |
|
|
53
|
+
| `text[1:10]` | — | — | Array with size constraints |
|
|
46
54
|
|
|
47
55
|
---
|
|
48
56
|
|
|
@@ -291,22 +299,29 @@ input {
|
|
|
291
299
|
|
|
292
300
|
## Nullable vs Optional
|
|
293
301
|
|
|
302
|
+
The `?` marker controls two independent behaviors based on where it's placed:
|
|
303
|
+
|
|
304
|
+
- **`?` after the type** (e.g., `text?`) → **nullable**: the value can be `null`
|
|
305
|
+
- **`?` after the variable name** (e.g., `name?`) → **not required**: the caller can omit the field entirely
|
|
306
|
+
|
|
307
|
+
These combine to form four distinct behaviors:
|
|
308
|
+
|
|
294
309
|
```xs
|
|
295
310
|
input {
|
|
296
|
-
// Required, cannot be null
|
|
297
|
-
text
|
|
311
|
+
// Required, cannot be null — caller MUST provide a non-null value
|
|
312
|
+
text name filters=trim
|
|
298
313
|
|
|
299
|
-
// Required,
|
|
300
|
-
text?
|
|
314
|
+
// Required, CAN be null — caller MUST provide the field, but can send null
|
|
315
|
+
text? name filters=trim
|
|
301
316
|
|
|
302
|
-
// Optional, cannot be null
|
|
303
|
-
text
|
|
317
|
+
// Optional, cannot be null — caller can omit, but if sent must have a value
|
|
318
|
+
text name? filters=trim
|
|
304
319
|
|
|
305
|
-
// Optional,
|
|
306
|
-
text?
|
|
320
|
+
// Optional, CAN be null — caller can omit or send null
|
|
321
|
+
text? name? filters=trim
|
|
307
322
|
|
|
308
|
-
// Optional with default
|
|
309
|
-
text
|
|
323
|
+
// Optional with default — if omitted, uses the default value
|
|
324
|
+
text name?="hello"
|
|
310
325
|
}
|
|
311
326
|
```
|
|
312
327
|
|
package/package.json
CHANGED