@xano/developer-mcp 1.0.34 → 1.0.36

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.
Files changed (35) hide show
  1. package/README.md +17 -2
  2. package/dist/tools/index.d.ts +2 -15
  3. package/dist/tools/index.js +2 -2
  4. package/dist/tools/validate_xanoscript.d.ts +84 -9
  5. package/dist/tools/validate_xanoscript.js +345 -31
  6. package/dist/xanoscript.js +31 -1
  7. package/dist/xanoscript.test.js +6 -0
  8. package/dist/xanoscript_docs/README.md +56 -43
  9. package/dist/xanoscript_docs/addons.md +10 -0
  10. package/dist/xanoscript_docs/agents.md +15 -0
  11. package/dist/xanoscript_docs/apis.md +45 -24
  12. package/dist/xanoscript_docs/cheatsheet.md +252 -0
  13. package/dist/xanoscript_docs/database.md +37 -0
  14. package/dist/xanoscript_docs/docs_index.json +236 -0
  15. package/dist/xanoscript_docs/frontend.md +10 -0
  16. package/dist/xanoscript_docs/functions.md +18 -0
  17. package/dist/xanoscript_docs/integrations/cloud-storage.md +142 -0
  18. package/dist/xanoscript_docs/integrations/external-apis.md +201 -0
  19. package/dist/xanoscript_docs/integrations/redis.md +194 -0
  20. package/dist/xanoscript_docs/integrations/search.md +242 -0
  21. package/dist/xanoscript_docs/integrations/utilities.md +331 -0
  22. package/dist/xanoscript_docs/integrations.md +55 -901
  23. package/dist/xanoscript_docs/mcp-servers.md +10 -0
  24. package/dist/xanoscript_docs/performance.md +15 -0
  25. package/dist/xanoscript_docs/quickstart.md +288 -41
  26. package/dist/xanoscript_docs/run.md +10 -0
  27. package/dist/xanoscript_docs/security.md +26 -0
  28. package/dist/xanoscript_docs/streaming.md +10 -0
  29. package/dist/xanoscript_docs/syntax.md +78 -0
  30. package/dist/xanoscript_docs/tables.md +15 -0
  31. package/dist/xanoscript_docs/tasks.md +11 -0
  32. package/dist/xanoscript_docs/tools.md +15 -0
  33. package/dist/xanoscript_docs/triggers.md +57 -192
  34. package/dist/xanoscript_docs/types.md +18 -0
  35. package/package.json +1 -1
@@ -185,3 +185,13 @@ The MCP protocol handles:
185
185
  2. **Comprehensive instructions** - Guide AI on server's overall purpose
186
186
  3. **Logical tool grouping** - Group related tools in one server
187
187
  4. **Keep focused** - One domain per server (support, analytics, etc.)
188
+
189
+ ---
190
+
191
+ ## Related Topics
192
+
193
+ | Topic | Description |
194
+ |-------|-------------|
195
+ | `tools` | AI tool definitions used by MCP servers |
196
+ | `agents` | AI agent configuration |
197
+ | `triggers` | MCP server triggers for connection events |
@@ -6,6 +6,10 @@ applyTo: "function/**/*.xs, api/**/*.xs"
6
6
 
7
7
  Best practices for building fast, efficient XanoScript applications.
8
8
 
9
+ > **TL;DR:** Index frequently queried fields. Use `select` to fetch only needed columns. Use `db.add_bulk`/`db.edit_bulk` for batch operations. Cache with Redis. Paginate large result sets.
10
+
11
+ ---
12
+
9
13
  ## Quick Reference
10
14
 
11
15
  | Area | Key Techniques |
@@ -387,3 +391,14 @@ conditional {
387
391
  8. **Filter early** - In database, not application code
388
392
  9. **Stream large responses** - Don't load into memory
389
393
  10. **Monitor performance** - Log slow operations
394
+
395
+ ---
396
+
397
+ ## Related Topics
398
+
399
+ | Topic | Description |
400
+ |-------|-------------|
401
+ | `database` | Query optimization |
402
+ | `integrations/redis` | Caching patterns |
403
+ | `streaming` | Large data handling |
404
+ | `debugging` | Performance monitoring |
@@ -6,8 +6,66 @@ applyTo: "**/*.xs"
6
6
 
7
7
  Essential patterns for XanoScript development. Use this as a quick reference for frequently-used code patterns.
8
8
 
9
+ > **TL;DR:** Quick reference for common patterns. Key rules: use `text` not `string`, `elseif` not `else if`, `params` not `body` for api.request, parentheses around filters in expressions.
10
+
9
11
  ## Quick Reference
10
12
 
13
+ ### Reserved Variable Names
14
+
15
+ These variable names are reserved and cannot be used:
16
+
17
+ | Variable | Description |
18
+ |----------|-------------|
19
+ | `$response` | API/function response (auto-populated) |
20
+ | `$output` | Output value |
21
+ | `$input` | Input parameters from request/function call |
22
+ | `$auth` | Authenticated user context |
23
+ | `$env` | Environment variables and request context |
24
+ | `$db` | Database table reference for queries |
25
+ | `$this` | Current context reference |
26
+ | `$result` | Used in reduce operations |
27
+
28
+ ```xs
29
+ // ❌ Wrong - using reserved variable name
30
+ var $response { value = "test" } // Error: $response is reserved
31
+
32
+ // ✅ Correct - use a different name
33
+ var $api_response { value = "test" }
34
+ var $my_result { value = "test" }
35
+ ```
36
+
37
+ ### Type Names (Common Aliases)
38
+
39
+ XanoScript uses specific type names. Common aliases from other languages won't work.
40
+
41
+ > **Full reference:** For complete type details and validation, see `xanoscript_docs({ topic: "types" })`.
42
+
43
+ | ❌ Wrong | ✅ Correct | Description |
44
+ |----------|------------|-------------|
45
+ | `boolean` | `bool` | Boolean true/false |
46
+ | `integer` | `int` | 32-bit integer |
47
+ | `string` | `text` | UTF-8 string |
48
+ | `number` | `decimal` | Floating-point number |
49
+ | `float` | `decimal` | Floating-point number |
50
+ | `array` | `type[]` | Array (e.g., `text[]`, `int[]`) |
51
+ | `list` | `type[]` | Array (e.g., `text[]`, `int[]`) |
52
+
53
+ ```xs
54
+ // ❌ Wrong - invalid type names
55
+ input {
56
+ boolean is_active // Error: use "bool"
57
+ integer count // Error: use "int"
58
+ string name // Error: use "text"
59
+ }
60
+
61
+ // ✅ Correct - proper XanoScript types
62
+ input {
63
+ bool is_active
64
+ int count
65
+ text name
66
+ }
67
+ ```
68
+
11
69
  ### Variable Declaration
12
70
  ```xs
13
71
  var $name { value = "initial value" }
@@ -35,7 +93,7 @@ conditional {
35
93
  api.request {
36
94
  url = "https://api.example.com/data"
37
95
  method = "POST"
38
- params = $payload
96
+ params = $payload // Note: "params" is used for request body, NOT "body"
39
97
  headers = ["Content-Type: application/json", "Authorization: Bearer " ~ $env.API_KEY]
40
98
  } as $api_result
41
99
 
@@ -47,6 +105,27 @@ precondition ($api_result.response.status == 200) {
47
105
  var $data { value = $api_result.response.result }
48
106
  ```
49
107
 
108
+ ### api.request Response Structure
109
+ The response object contains:
110
+ ```xs
111
+ $result.response.status // HTTP status code (200, 404, 500, etc.)
112
+ $result.response.result // Parsed response body (JSON decoded)
113
+ $result.response.headers // Response headers object
114
+ ```
115
+
116
+ ### While Loop
117
+ ```xs
118
+ stack {
119
+ var $counter { value = 0 }
120
+ while ($counter < 10) {
121
+ each {
122
+ var.update $counter { value = $counter + 1 }
123
+ debug.log { value = "Iteration: " ~ ($counter|to_text) }
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
50
129
  ### String Concatenation
51
130
  ```xs
52
131
  var $greeting { value = "Hello, " ~ $input.name ~ "!" }
@@ -55,6 +134,70 @@ var $greeting { value = "Hello, " ~ $input.name ~ "!" }
55
134
  var $message { value = "Status: " ~ ($status|to_text) ~ " - " ~ ($data|json_encode) }
56
135
  ```
57
136
 
137
+ ### Input Block Syntax
138
+
139
+ > **Full reference:** For complete input types and validation options, see `xanoscript_docs({ topic: "types" })`.
140
+
141
+ ```xs
142
+ input {
143
+ // Required input
144
+ text name
145
+
146
+ // Optional input (can be omitted)
147
+ text nickname?
148
+
149
+ // Optional with default value
150
+ text role?="user"
151
+
152
+ // With filters applied
153
+ email contact filters=trim|lower
154
+
155
+ // Optional with default AND filters
156
+ text search?="" filters=trim
157
+
158
+ // Array type
159
+ text[] tags filters=trim
160
+
161
+ // Nested object with schema
162
+ object address {
163
+ schema {
164
+ text street
165
+ text city
166
+ text country?="US"
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ ### Error Types Reference
173
+
174
+ > **Full reference:** For try-catch, throw, and preconditions, see `xanoscript_docs({ topic: "syntax" })`.
175
+
176
+ | Type | HTTP Status | Use Case |
177
+ |------|-------------|----------|
178
+ | `inputerror` | 400 Bad Request | Invalid input data |
179
+ | `accessdenied` | 403 Forbidden | Authorization failure |
180
+ | `notfound` | 404 Not Found | Resource doesn't exist |
181
+ | `standard` | 500 Internal Server Error | General errors |
182
+
183
+ ### Quick Filter Reference
184
+
185
+ The most common filters at a glance:
186
+
187
+ | Filter | Example | Result |
188
+ |--------|---------|--------|
189
+ | `trim` | `" hello "|trim` | `"hello"` |
190
+ | `lower` | `"HELLO"|lower` | `"hello"` |
191
+ | `first` | `[1,2,3]|first` | `1` |
192
+ | `count` | `[1,2,3]|count` | `3` |
193
+ | `to_int` | `"42"|to_int` | `42` |
194
+ | `json_encode` | `{a:1}|json_encode` | `"{\"a\":1}"` |
195
+ | `get` | `$obj|get:"key":"default"` | value or default |
196
+
197
+ **Null handling:** `$val ?? "default"` or `$val|first_notnull:"default"`
198
+
199
+ > **Full reference:** See `xanoscript_docs({ topic: "syntax" })` for all 100+ filters organized by category (string, array, object, type, date, encoding).
200
+
58
201
  ---
59
202
 
60
203
  ## Common Patterns
@@ -77,35 +220,15 @@ precondition ($input.email|contains:"@") {
77
220
 
78
221
  ### 2. Database CRUD
79
222
 
80
- ```xs
81
- // Create
82
- db.add "user" {
83
- data = { name: $input.name, email: $input.email }
84
- } as $new_user
85
-
86
- // Read one
87
- db.get "user" {
88
- where = $db.user.id == $input.id
89
- } as $user
90
-
91
- // Read many
92
- db.query "user" {
93
- where = $db.user.is_active == true
94
- order = [{ field: created_at, direction: desc }]
95
- paging = { limit: 10, offset: 0 }
96
- } as $users
97
-
98
- // Update
99
- db.edit "user" {
100
- where = $db.user.id == $input.id
101
- data = { name: $input.name }
102
- }
223
+ | Operation | Use Case | Example |
224
+ |-----------|----------|---------|
225
+ | `db.get` | Single record by ID | `db.get "users" { field_name = "id" field_value = 1 } as $user` |
226
+ | `db.query` | Filtered list | `db.query "users" { where = $db.users.active == true } as $users` |
227
+ | `db.add` | Insert | `db.add "users" { data = { name: "John" } } as $new` |
228
+ | `db.edit` | Update | `db.edit "users" { field_name = "id" field_value = 1 data = { name: "Jane" } }` |
229
+ | `db.delete` | Delete | `db.delete "users" { field_name = "id" field_value = 1 }` |
103
230
 
104
- // Delete
105
- db.delete "user" {
106
- where = $db.user.id == $input.id
107
- }
108
- ```
231
+ > **Full reference:** See `xanoscript_docs({ topic: "database" })` for joins, bulk operations, transactions, and more.
109
232
 
110
233
  ### 3. Optional Field Handling
111
234
 
@@ -142,6 +265,8 @@ var $active_items { value = $items|filter:$$.is_active == true }
142
265
 
143
266
  ### 5. Error Handling with Try-Catch
144
267
 
268
+ > **Full reference:** For all error handling patterns, see `xanoscript_docs({ topic: "syntax" })`.
269
+
145
270
  ```xs
146
271
  try_catch {
147
272
  try {
@@ -159,6 +284,8 @@ try_catch {
159
284
 
160
285
  ### 6. Authentication Check
161
286
 
287
+ > **Full reference:** For security best practices, see `xanoscript_docs({ topic: "security" })`.
288
+
162
289
  ```xs
163
290
  // Require authenticated user
164
291
  precondition ($auth.id != null) {
@@ -220,6 +347,8 @@ var $response {
220
347
 
221
348
  ### 9. Date/Time Operations
222
349
 
350
+ > **Full reference:** For all date/time filters, see `xanoscript_docs({ topic: "syntax" })`.
351
+
223
352
  ```xs
224
353
  // Current timestamp
225
354
  var $now { value = now }
@@ -239,6 +368,8 @@ db.query "event" {
239
368
 
240
369
  ### 10. JSON API Response
241
370
 
371
+ > **Full reference:** For external API patterns, see `xanoscript_docs({ topic: "integrations" })`.
372
+
242
373
  ```xs
243
374
  api.request {
244
375
  url = "https://api.openai.com/v1/chat/completions"
@@ -287,42 +418,104 @@ conditional {
287
418
 
288
419
  ### 2. Missing parentheses in filter concatenation
289
420
  ```xs
290
- // ❌ Wrong
421
+ // ❌ Wrong - parse error
291
422
  var $msg { value = $status|to_text ~ " - " ~ $data|json_encode }
292
423
 
293
- // ✅ Correct
424
+ // ✅ Correct - wrap filtered expressions in parentheses
294
425
  var $msg { value = ($status|to_text) ~ " - " ~ ($data|json_encode) }
295
426
  ```
296
427
 
297
- ### 3. Using `body` instead of `params` for api.request
428
+ ### 3. Missing parentheses in filter comparisons
298
429
  ```xs
299
- // ❌ Wrong
430
+ // ❌ Wrong - parse error
431
+ if ($array|count > 0) { }
432
+
433
+ // ✅ Correct - wrap filter expression in parentheses
434
+ if (($array|count) > 0) { }
435
+ ```
436
+
437
+ ### 4. Using `body` instead of `params` for api.request
438
+ ```xs
439
+ // ❌ Wrong - "body" is not valid
300
440
  api.request {
301
441
  url = "..."
302
442
  method = "POST"
303
- body = $payload // "body" is not valid!
443
+ body = $payload
304
444
  }
305
445
 
306
- // ✅ Correct
446
+ // ✅ Correct - use "params" for request body
307
447
  api.request {
308
448
  url = "..."
309
449
  method = "POST"
310
- params = $payload // Use "params" for request body
450
+ params = $payload
311
451
  }
312
452
  ```
313
453
 
314
- ### 4. Using `default` filter (doesn't exist)
454
+ ### 5. Using `default` filter (doesn't exist)
315
455
  ```xs
316
- // ❌ Wrong
456
+ // ❌ Wrong - no "default" filter exists
317
457
  var $value { value = $input.optional|default:"fallback" }
318
458
 
319
- // ✅ Correct
459
+ // ✅ Correct - use first_notnull or ?? operator
320
460
  var $value { value = $input.optional|first_notnull:"fallback" }
321
461
  // or
322
462
  var $value { value = $input.optional ?? "fallback" }
463
+
464
+ // For object key access with default, use get with 3rd parameter
465
+ var $val { value = $obj|get:"key":"default_value" }
466
+ ```
467
+
468
+ ### 6. Using reserved variable names
469
+ ```xs
470
+ // ❌ Wrong - $response is reserved
471
+ var $response { value = "test" }
472
+
473
+ // ✅ Correct - use a different name
474
+ var $api_response { value = "test" }
475
+ ```
476
+
477
+ ### 7. Wrong type names
478
+ ```xs
479
+ // ❌ Wrong - invalid type names
480
+ input {
481
+ boolean active // Use "bool"
482
+ integer count // Use "int"
483
+ string name // Use "text"
484
+ }
485
+
486
+ // ✅ Correct
487
+ input {
488
+ bool active
489
+ int count
490
+ text name
491
+ }
492
+ ```
493
+
494
+ ### 8. Object literal syntax (using = instead of :)
495
+ ```xs
496
+ // ❌ Wrong - object literals use : not =
497
+ var $data { value = { customer = $id } }
498
+
499
+ // ✅ Correct - use : for object properties
500
+ var $data { value = { customer: $id } }
323
501
  ```
324
502
 
325
- ### 5. Using $env in run.job input blocks
503
+ ### 9. Throw block with commas
504
+ ```xs
505
+ // ❌ Wrong - throw blocks don't use commas
506
+ throw {
507
+ name = "Error",
508
+ value = "message"
509
+ }
510
+
511
+ // ✅ Correct - no commas between properties
512
+ throw {
513
+ name = "Error"
514
+ value = "message"
515
+ }
516
+ ```
517
+
518
+ ### 10. Using $env in run.job input blocks
326
519
  ```xs
327
520
  // ❌ Wrong - $env not allowed in input blocks
328
521
  run.job "my_job" {
@@ -331,10 +524,64 @@ run.job "my_job" {
331
524
  }
332
525
  }
333
526
 
334
- // ✅ Correct - use $env in the stack
527
+ // ✅ Correct - access $env in the stack instead
335
528
  run.job "my_job" {
336
529
  stack {
337
530
  var $api_key { value = $env.API_KEY }
338
531
  }
339
532
  }
340
533
  ```
534
+
535
+ ### 11. Using `object` type without schema
536
+ ```xs
537
+ // ❌ Wrong - object requires a schema
538
+ input {
539
+ object data // Error: needs schema
540
+ }
541
+
542
+ // ✅ Correct - use json for arbitrary data
543
+ input {
544
+ json data // Accepts any JSON
545
+ }
546
+
547
+ // ✅ Or define a schema for object
548
+ input {
549
+ object data {
550
+ schema {
551
+ text name
552
+ int id
553
+ }
554
+ }
555
+ }
556
+ ```
557
+
558
+ ### 12. While loop outside of stack block
559
+ ```xs
560
+ // ❌ Wrong - while must be inside stack
561
+ while (true) {
562
+ each { ... }
563
+ }
564
+
565
+ // ✅ Correct - wrap in stack block
566
+ stack {
567
+ while (true) {
568
+ each { ... }
569
+ }
570
+ }
571
+ ```
572
+
573
+ ---
574
+
575
+ ## Related Topics
576
+
577
+ Explore more with `xanoscript_docs({ topic: "<topic>" })`:
578
+
579
+ | Topic | Description |
580
+ |-------|-------------|
581
+ | `syntax` | Complete filter reference, operators, system variables |
582
+ | `types` | Data types, input validation, schema definitions |
583
+ | `database` | All db.* operations: query, get, add, edit, delete |
584
+ | `functions` | Reusable function stacks, async patterns, loops |
585
+ | `apis` | HTTP endpoints, authentication, CRUD patterns |
586
+ | `security` | Security best practices and authentication |
587
+ | `integrations` | External API patterns (OpenAI, Stripe, etc.) |
@@ -366,3 +366,13 @@ query list verb=GET {
366
366
  3. **Keep self-contained** - Include all required tables and functions
367
367
  4. **Seed test data** - Use `items` in table definitions for testing
368
368
  5. **Validate inputs** - Use preconditions in functions for input validation
369
+
370
+ ---
371
+
372
+ ## Related Topics
373
+
374
+ | Topic | Description |
375
+ |-------|-------------|
376
+ | `functions` | Function stacks run by jobs |
377
+ | `tasks` | Scheduled task definitions |
378
+ | `tables` | Database tables accessed by jobs |
@@ -6,6 +6,21 @@ applyTo: "function/**/*.xs, api/**/*.xs"
6
6
 
7
7
  Best practices for building secure XanoScript applications.
8
8
 
9
+ > **TL;DR:** Always check `$auth.id` for protected endpoints. Use `security.create_auth_token` for JWT. Validate all inputs with `filters=`. Hash passwords with `password` type. Use `$env.SECRET_NAME` for secrets.
10
+
11
+ ## Section Index
12
+
13
+ - [Authentication](#authentication) (L24) - Tokens, sessions, MFA
14
+ - [Authorization](#authorization) (L186) - Role checks, ownership
15
+ - [Input Validation](#input-validation) (L277) - Type enforcement, sanitization
16
+ - [Data Protection](#data-protection) (L339) - Encryption, hashing, secrets
17
+ - [Rate Limiting](#rate-limiting--abuse-prevention) (L427) - API limits, abuse prevention
18
+ - [Security Headers](#security-headers) (L486) - CORS configuration
19
+ - [Audit Logging](#audit-logging) (L504) - Security event tracking
20
+ - [Best Practices Summary](#best-practices-summary) (L545) - Quick checklist
21
+
22
+ ---
23
+
9
24
  ## Quick Reference
10
25
 
11
26
  | Area | Key Practices |
@@ -550,3 +565,14 @@ function.run "audit_log" {
550
565
  8. **Log security events** - Audit trail for compliance
551
566
  9. **Use HTTPS** - Always (handled by platform)
552
567
  10. **Rotate tokens** - Implement refresh token flow
568
+
569
+ ---
570
+
571
+ ## Related Topics
572
+
573
+ | Topic | Description |
574
+ |-------|-------------|
575
+ | `apis` | Endpoint authentication |
576
+ | `types` | Input validation |
577
+ | `middleware` | Request interceptors |
578
+ | `integrations/redis` | Rate limiting |
@@ -338,3 +338,13 @@ query "stream_large_dataset" {
338
338
  3. **Handle errors gracefully** - Log failures without stopping stream
339
339
  4. **Set appropriate chunk sizes** - Balance memory and performance
340
340
  5. **Use JSONL for structured data** - Easier to parse than multi-line JSON
341
+
342
+ ---
343
+
344
+ ## Related Topics
345
+
346
+ | Topic | Description |
347
+ |-------|-------------|
348
+ | `integrations` | Cloud storage for file sources |
349
+ | `apis` | Streaming API responses |
350
+ | `database` | Processing streamed data into tables |
@@ -6,6 +6,62 @@ applyTo: "**/*.xs"
6
6
 
7
7
  Complete reference for XanoScript expressions, operators, and filters.
8
8
 
9
+ > **TL;DR:** XanoScript uses `|` for filters (`$text|trim`), `~` for string concat, and standard operators (`==`, `!=`, `&&`, `||`). Filters are chainable. Error handling uses `precondition`, `try_catch`, and `throw`.
10
+
11
+ ## Section Index
12
+
13
+ | Section | Contents |
14
+ |---------|----------|
15
+ | [Operators](#quick-reference) | Comparison, logical, math, null-safe |
16
+ | [Conditional Blocks](#conditional-blocks) | `conditional`, `if`/`elseif`/`else` |
17
+ | [Expressions](#expressions) | Backtick syntax, comparisons |
18
+ | [Math Filters](#math-filters) | `add`, `subtract`, `round`, `abs`, `ceil`, `floor` |
19
+ | [String Filters](#string-filters) | `trim`, `to_lower`, `to_upper`, `substr`, `split`, `replace` |
20
+ | [Array Filters](#array-filters) | `first`, `last`, `count`, `map`, `filter`, `reduce` |
21
+ | [Object Filters](#object-filters) | `get`, `set`, `has`, `keys`, `values` |
22
+ | [Type Filters](#type-filters) | `to_int`, `to_text`, `to_bool`, `json_encode` |
23
+ | [Date/Time Filters](#datetime-filters) | `to_timestamp`, `format_timestamp` |
24
+ | [Encoding Filters](#encoding-filters) | `url_encode`, `base64_encode`, `json_encode` |
25
+ | [Security Filters](#security-filters) | `md5`, `sha256`, `encrypt`, `jws_encode` |
26
+ | [DB Query Filters](#db-query-filters) | `contains`, `includes`, `between`, `within` |
27
+ | [Error Handling](#error-handling) | `precondition`, `try_catch`, `throw` |
28
+ | [System Variables](#system-variables) | `$env.*`, `$auth.*`, request context |
29
+
30
+ ## Choosing a Filter
31
+
32
+ ```
33
+ Working with...
34
+ ├── Strings?
35
+ │ ├── Clean whitespace? → trim, ltrim, rtrim
36
+ │ ├── Change case? → to_lower, to_upper, capitalize
37
+ │ ├── Extract part? → substr
38
+ │ ├── Split to array? → split
39
+ │ ├── Find/replace? → replace, contains
40
+ │ └── Get length? → strlen
41
+ ├── Arrays?
42
+ │ ├── Get element? → first, last, get
43
+ │ ├── Count items? → count
44
+ │ ├── Transform all? → map
45
+ │ ├── Keep some? → filter
46
+ │ ├── Find one? → find
47
+ │ ├── Combine? → reduce
48
+ │ └── Sort? → sort
49
+ ├── Objects?
50
+ │ ├── Get value? → get
51
+ │ ├── Set value? → set
52
+ │ ├── Check key? → has
53
+ │ └── Extract? → keys, values
54
+ ├── Convert type?
55
+ │ ├── To number? → to_int, to_decimal
56
+ │ ├── To string? → to_text
57
+ │ ├── To boolean? → to_bool
58
+ │ └── To/from JSON? → json_encode, json_decode
59
+ └── Check value?
60
+ ├── Is null? → is_null
61
+ ├── Is empty? → is_empty
62
+ └── Get type? → is_array, is_object, is_int, is_text
63
+ ```
64
+
9
65
  ## Quick Reference
10
66
 
11
67
  ### Operators
@@ -280,6 +336,8 @@ Generate numeric ranges with the `..` operator:
280
336
 
281
337
  ## Type Filters
282
338
 
339
+ > **Full reference:** For input types and validation, see `xanoscript_docs({ topic: "types" })`.
340
+
283
341
  | Filter | Example | Result |
284
342
  |--------|---------|--------|
285
343
  | `to_int` | `"123"\|to_int` | `123` |
@@ -343,6 +401,8 @@ $ts|timestamp_day_of_week // Day (0=Sunday)
343
401
 
344
402
  ## Security Filters
345
403
 
404
+ > **Full reference:** For security best practices, see `xanoscript_docs({ topic: "security" })`.
405
+
346
406
  | Filter | Example |
347
407
  |--------|---------|
348
408
  | `md5` | `"text"\|md5` |
@@ -359,6 +419,8 @@ $ts|timestamp_day_of_week // Day (0=Sunday)
359
419
 
360
420
  ## DB Query Filters
361
421
 
422
+ > **Full reference:** For complete database operations, see `xanoscript_docs({ topic: "database" })`.
423
+
362
424
  Used in `db.query` where clauses:
363
425
 
364
426
  | Filter | Example | Description |
@@ -731,6 +793,8 @@ $db.created_at|timestamp_epoch_ms // Milliseconds since epoch
731
793
 
732
794
  ### Vector Operations (AI/ML)
733
795
 
796
+ > **Full reference:** For AI agents and embeddings, see `xanoscript_docs({ topic: "agents" })`.
797
+
734
798
  Additional vector similarity functions:
735
799
 
736
800
  ```xs
@@ -741,3 +805,17 @@ $db.embedding|inner_product:$input.vector // Inner product
741
805
  // Geo covers (for polygon containment)
742
806
  $db.boundary|covers:$input.point // Polygon covers point
743
807
  ```
808
+
809
+ ---
810
+
811
+ ## Related Topics
812
+
813
+ Explore more with `xanoscript_docs({ topic: "<topic>" })`:
814
+
815
+ | Topic | Description |
816
+ |-------|-------------|
817
+ | `quickstart` | Common patterns, examples, mistakes to avoid |
818
+ | `types` | Data types, input validation, schema definitions |
819
+ | `database` | All db.* operations with query examples |
820
+ | `functions` | Reusable function stacks, async patterns |
821
+ | `security` | Security best practices and authentication |
@@ -6,6 +6,10 @@ applyTo: "table/**/*.xs"
6
6
 
7
7
  Database table definitions in XanoScript.
8
8
 
9
+ > **TL;DR:** Every table needs `int id` as primary key. Use `auth = true` for user tables. Add indexes for frequently queried fields. Use `filters=` for validation on fields.
10
+
11
+ ---
12
+
9
13
  ## Quick Reference
10
14
 
11
15
  ```xs
@@ -311,3 +315,14 @@ table "order" {
311
315
  3. **Add indexes** for fields used in WHERE clauses and JOINs
312
316
  4. **Use appropriate types** - `email` for emails, `password` for credentials
313
317
  5. **Default timestamps** - Use `?=now` for created_at fields
318
+
319
+ ---
320
+
321
+ ## Related Topics
322
+
323
+ | Topic | Description |
324
+ |-------|-------------|
325
+ | `database` | CRUD operations on tables |
326
+ | `types` | Data types and validation |
327
+ | `triggers` | Table triggers for CRUD events |
328
+ | `addons` | Reusable subqueries |
@@ -257,3 +257,14 @@ task "risky_sync" {
257
257
  3. **Consider timezone** - Schedule uses UTC (+0000)
258
258
  4. **Batch operations** - Process in chunks for large datasets
259
259
  5. **Set end dates** - Use ends_on for temporary schedules
260
+
261
+ ---
262
+
263
+ ## Related Topics
264
+
265
+ | Topic | Description |
266
+ |-------|-------------|
267
+ | `functions` | Reusable function stacks |
268
+ | `database` | Database operations in tasks |
269
+ | `debugging` | Logging and debugging task execution |
270
+ | `triggers` | Event-driven alternatives to scheduled tasks |