@xano/developer-mcp 1.0.40 → 1.0.42
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.
- package/README.md +47 -84
- package/dist/cli_docs/index.js +7 -2
- package/dist/lib.d.ts +1 -3
- package/dist/lib.js +1 -4
- package/dist/meta_api_docs/format.d.ts +0 -4
- package/dist/meta_api_docs/format.js +0 -15
- package/dist/meta_api_docs/format.test.js +7 -9
- package/dist/meta_api_docs/index.js +10 -3
- package/dist/tools/index.d.ts +3 -5
- package/dist/tools/index.js +2 -9
- package/dist/tools/validate_xanoscript.js +10 -5
- package/dist/tools/xanoscript_docs.js +11 -5
- package/dist/xanoscript_docs/docs_index.json +70 -1
- package/dist/xanoscript_docs/integrations/cloud-storage.md +59 -3
- package/dist/xanoscript_docs/integrations/redis.md +28 -8
- package/dist/xanoscript_docs/integrations/search.md +39 -3
- package/dist/xanoscript_docs/integrations/utilities.md +25 -0
- package/dist/xanoscript_docs/security.md +39 -0
- package/dist/xanoscript_docs/syntax.md +411 -4
- package/dist/xanoscript_docs/version.json +2 -2
- package/package.json +1 -1
- package/dist/run_api_docs/format.d.ts +0 -6
- package/dist/run_api_docs/format.js +0 -8
- package/dist/run_api_docs/format.test.d.ts +0 -1
- package/dist/run_api_docs/format.test.js +0 -86
- package/dist/run_api_docs/index.d.ts +0 -52
- package/dist/run_api_docs/index.js +0 -90
- package/dist/run_api_docs/index.test.d.ts +0 -1
- package/dist/run_api_docs/index.test.js +0 -127
- package/dist/run_api_docs/topics/data.d.ts +0 -2
- package/dist/run_api_docs/topics/data.js +0 -104
- package/dist/run_api_docs/topics/history.d.ts +0 -2
- package/dist/run_api_docs/topics/history.js +0 -93
- package/dist/run_api_docs/topics/run.d.ts +0 -2
- package/dist/run_api_docs/topics/run.js +0 -110
- package/dist/run_api_docs/topics/session.d.ts +0 -2
- package/dist/run_api_docs/topics/session.js +0 -166
- package/dist/run_api_docs/topics/start.d.ts +0 -2
- package/dist/run_api_docs/topics/start.js +0 -97
- package/dist/run_api_docs/topics/workflows.d.ts +0 -2
- package/dist/run_api_docs/topics/workflows.js +0 -140
- package/dist/tools/run_api_docs.d.ts +0 -46
- package/dist/tools/run_api_docs.js +0 -69
|
@@ -18,6 +18,10 @@ Complete reference for XanoScript expressions, operators, and filters.
|
|
|
18
18
|
| [Math Filters](#math-filters) | `add`, `subtract`, `round`, `abs`, `ceil`, `floor` |
|
|
19
19
|
| [String Filters](#string-filters) | `trim`, `to_lower`, `to_upper`, `substr`, `split`, `replace` |
|
|
20
20
|
| [Array Filters](#array-filters) | `first`, `last`, `count`, `map`, `filter`, `reduce` |
|
|
21
|
+
| [Array Functions](#array-functions) | `array.push`, `array.pop`, `array.map`, `array.filter`, `array.group_by` |
|
|
22
|
+
| [Text Functions](#text-functions) | `text.contains`, `text.starts_with`, `text.trim`, `text.append`, `text.prepend` |
|
|
23
|
+
| [Math Functions](#math-functions) | `math.add`, `math.sub`, `math.mul`, `math.div`, `math.bitwise.*` |
|
|
24
|
+
| [Object Functions](#object-functions) | `object.keys`, `object.values`, `object.entries` |
|
|
21
25
|
| [Object Filters](#object-filters) | `get`, `set`, `has`, `keys`, `values` |
|
|
22
26
|
| [Type Filters](#type-filters) | `to_int`, `to_text`, `to_bool`, `json_encode` |
|
|
23
27
|
| [Date/Time Filters](#datetime-filters) | `to_timestamp`, `format_timestamp` |
|
|
@@ -56,12 +60,13 @@ Working with...
|
|
|
56
60
|
├── Arrays? → USE ARRAY FILTERS ONLY (see Array Filters section)
|
|
57
61
|
│ ├── Get element? → first, last, get
|
|
58
62
|
│ ├── Count items? → count (NOT strlen)
|
|
59
|
-
│ ├── Transform all? → map
|
|
60
|
-
│ ├── Keep some? → filter
|
|
61
|
-
│ ├── Find one? → find
|
|
63
|
+
│ ├── Transform all? → map (filter) or array.map (statement)
|
|
64
|
+
│ ├── Keep some? → filter (filter) or array.filter (statement)
|
|
65
|
+
│ ├── Find one? → find (filter) or array.find (statement)
|
|
62
66
|
│ ├── Combine? → reduce
|
|
63
67
|
│ ├── Reverse? → reverse (NOT available on strings)
|
|
64
|
-
│
|
|
68
|
+
│ ├── Sort? → sort
|
|
69
|
+
│ └── Statement-level ops? → See Array Functions (array.push, array.pop, etc.)
|
|
65
70
|
├── Objects?
|
|
66
71
|
│ ├── Get value? → get
|
|
67
72
|
│ ├── Set value? → set
|
|
@@ -335,6 +340,408 @@ Generate numeric ranges with the `..` operator:
|
|
|
335
340
|
|
|
336
341
|
---
|
|
337
342
|
|
|
343
|
+
## Array Functions
|
|
344
|
+
|
|
345
|
+
Statement-level functions for manipulating arrays within stacks. Unlike filters (e.g., `$arr|push:3`), these are standalone operations.
|
|
346
|
+
|
|
347
|
+
> **Syntax note:** Functions that use a `{ by = ... }` or `{ value = ... }` block wrap the array in parentheses — e.g., `array.map ($arr) { ... }`. Functions that use an `if (...)` condition take a bare variable — e.g., `array.filter $arr if (...) as $result`.
|
|
348
|
+
|
|
349
|
+
### array.push
|
|
350
|
+
|
|
351
|
+
Appends a new element to the end of an array.
|
|
352
|
+
|
|
353
|
+
```xs
|
|
354
|
+
array.push $shopping_cart {
|
|
355
|
+
value = "oranges"
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### array.unshift
|
|
360
|
+
|
|
361
|
+
Inserts a new element at the beginning of an array, shifting existing elements to higher indexes.
|
|
362
|
+
|
|
363
|
+
```xs
|
|
364
|
+
array.unshift $priority_tasks {
|
|
365
|
+
value = "urgent meeting"
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### array.pop
|
|
370
|
+
|
|
371
|
+
Removes and returns the last element of an array. The removed element is stored in the `as` variable.
|
|
372
|
+
|
|
373
|
+
```xs
|
|
374
|
+
array.pop $completed_tasks as $last_finished_task
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### array.shift
|
|
378
|
+
|
|
379
|
+
Removes and returns the first element of an array. The removed element is stored in the `as` variable.
|
|
380
|
+
|
|
381
|
+
```xs
|
|
382
|
+
array.shift $waiting_list as $next_customer
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### array.merge
|
|
386
|
+
|
|
387
|
+
Combines another array or a single value into the target array, appending all elements from the provided `value`.
|
|
388
|
+
|
|
389
|
+
```xs
|
|
390
|
+
array.merge $active_users {
|
|
391
|
+
value = $new_users
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### array.find
|
|
396
|
+
|
|
397
|
+
Searches an array and returns the first element that meets the specified condition. Returns `null` if no match.
|
|
398
|
+
|
|
399
|
+
```xs
|
|
400
|
+
array.find $customer_ages if ($this > 18) as $first_adult_age
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### array.find_index
|
|
404
|
+
|
|
405
|
+
Returns the index of the first element that satisfies the condition. Returns `-1` if no match.
|
|
406
|
+
|
|
407
|
+
```xs
|
|
408
|
+
array.find_index $sale_prices if ($this < 20) as $first_discount_index
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### array.has
|
|
412
|
+
|
|
413
|
+
Checks if at least one element meets the condition. Returns `true` or `false`.
|
|
414
|
+
|
|
415
|
+
```xs
|
|
416
|
+
array.has $team_roles if ($this == "manager") as $has_manager
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### array.every
|
|
420
|
+
|
|
421
|
+
Tests whether every element satisfies the condition. Returns `true` if all pass, `false` otherwise.
|
|
422
|
+
|
|
423
|
+
```xs
|
|
424
|
+
array.every $exam_scores if ($this >= 70) as $all_passed
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### array.filter
|
|
428
|
+
|
|
429
|
+
Creates a new array containing only the elements that meet the condition.
|
|
430
|
+
|
|
431
|
+
```xs
|
|
432
|
+
array.filter $temperatures if ($this > 32) as $above_freezing
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### array.filter_count
|
|
436
|
+
|
|
437
|
+
Counts how many elements satisfy the condition.
|
|
438
|
+
|
|
439
|
+
```xs
|
|
440
|
+
array.filter_count $survey_responses if ($this == "yes") as $yes_count
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### array.map
|
|
444
|
+
|
|
445
|
+
Transforms each element in an array based on a specified mapping. The `by` parameter defines the transformation.
|
|
446
|
+
|
|
447
|
+
```xs
|
|
448
|
+
array.map ($json) {
|
|
449
|
+
by = $this.email
|
|
450
|
+
} as $emails
|
|
451
|
+
|
|
452
|
+
array.map ($json) {
|
|
453
|
+
by = {name: $this.name, gender: $this.gender}
|
|
454
|
+
} as $people
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### array.partition
|
|
458
|
+
|
|
459
|
+
Divides an array into two groups based on a condition. Returns an object with `true` and `false` keys.
|
|
460
|
+
|
|
461
|
+
```xs
|
|
462
|
+
array.partition ($json) if ($this.gender == "male") as $is_male
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### array.group_by
|
|
466
|
+
|
|
467
|
+
Groups elements based on a specified key or expression. Returns an object where each key is a group.
|
|
468
|
+
|
|
469
|
+
```xs
|
|
470
|
+
array.group_by ($users) {
|
|
471
|
+
by = $this.gender
|
|
472
|
+
} as $user_by_gender
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### array.union
|
|
476
|
+
|
|
477
|
+
Combines two arrays ensuring all elements are unique based on the `by` key.
|
|
478
|
+
|
|
479
|
+
```xs
|
|
480
|
+
array.union ([1,3,5,7,9]) {
|
|
481
|
+
value = [2,4,6,8]
|
|
482
|
+
by = $this
|
|
483
|
+
} as $union
|
|
484
|
+
// Result: [1,2,3,4,5,6,7,8,9]
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### array.difference
|
|
488
|
+
|
|
489
|
+
Returns elements present in the first array but not in the second, based on the `by` key.
|
|
490
|
+
|
|
491
|
+
```xs
|
|
492
|
+
array.difference ([1,2,3,4,5,6,7,8,9]) {
|
|
493
|
+
value = [2,4,6,8]
|
|
494
|
+
by = $this
|
|
495
|
+
} as $difference
|
|
496
|
+
// Result: [1,3,5,7,9]
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### array.intersection
|
|
500
|
+
|
|
501
|
+
Returns elements present in both arrays, based on the `by` key.
|
|
502
|
+
|
|
503
|
+
```xs
|
|
504
|
+
array.intersection ([1,2,3,4,5,6,7,8,9]) {
|
|
505
|
+
value = [2,4,6,8]
|
|
506
|
+
by = $this
|
|
507
|
+
} as $intersection
|
|
508
|
+
// Result: [2,4,6,8]
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
## Text Functions
|
|
514
|
+
|
|
515
|
+
Statement-level functions for text manipulation within stacks. These operate directly on variables — checking conditions (returning `true`/`false` via `as`) or mutating the variable in place.
|
|
516
|
+
|
|
517
|
+
> **Syntax note:** Functions that check a condition (e.g., `text.contains`, `text.starts_with`) store the result in an `as` variable. Functions that modify text (e.g., `text.trim`, `text.append`) mutate the variable directly and do not return a value.
|
|
518
|
+
|
|
519
|
+
### text.contains
|
|
520
|
+
|
|
521
|
+
Checks if a text string contains the specified value. Returns `true` if found, `false` otherwise.
|
|
522
|
+
|
|
523
|
+
```xs
|
|
524
|
+
text.contains $log_entry {
|
|
525
|
+
value = "error"
|
|
526
|
+
} as $has_error
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### text.icontains
|
|
530
|
+
|
|
531
|
+
Performs a case-insensitive check to see if a text string contains the specified value.
|
|
532
|
+
|
|
533
|
+
```xs
|
|
534
|
+
text.icontains $description {
|
|
535
|
+
value = "error"
|
|
536
|
+
} as $has_error
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### text.starts_with
|
|
540
|
+
|
|
541
|
+
Checks if a text string begins with the specified value.
|
|
542
|
+
|
|
543
|
+
```xs
|
|
544
|
+
text.starts_with $message {
|
|
545
|
+
value = "Hello"
|
|
546
|
+
} as $starts_with_hello
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### text.istarts_with
|
|
550
|
+
|
|
551
|
+
Performs a case-insensitive check to see if a text string starts with the specified value.
|
|
552
|
+
|
|
553
|
+
```xs
|
|
554
|
+
text.istarts_with $title {
|
|
555
|
+
value = "intro"
|
|
556
|
+
} as $starts_with_intro
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### text.ends_with
|
|
560
|
+
|
|
561
|
+
Checks if a text string ends with the specified value.
|
|
562
|
+
|
|
563
|
+
```xs
|
|
564
|
+
text.ends_with $url {
|
|
565
|
+
value = ".com"
|
|
566
|
+
} as $is_com_domain
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
### text.iends_with
|
|
570
|
+
|
|
571
|
+
Performs a case-insensitive check to see if a text string ends with the specified value.
|
|
572
|
+
|
|
573
|
+
```xs
|
|
574
|
+
text.iends_with $filename {
|
|
575
|
+
value = "pdf"
|
|
576
|
+
} as $ends_with_pdf
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### text.trim
|
|
580
|
+
|
|
581
|
+
Removes characters (default is whitespace, or as specified by `value`) from both the beginning and end of a text string. Mutates the variable directly.
|
|
582
|
+
|
|
583
|
+
```xs
|
|
584
|
+
text.trim $user_input {
|
|
585
|
+
value = " "
|
|
586
|
+
}
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
### text.ltrim
|
|
590
|
+
|
|
591
|
+
Removes leading characters (default is whitespace, or as specified by `value`) from a text string. Mutates the variable directly.
|
|
592
|
+
|
|
593
|
+
```xs
|
|
594
|
+
text.ltrim $user_input {
|
|
595
|
+
value = " "
|
|
596
|
+
}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### text.rtrim
|
|
600
|
+
|
|
601
|
+
Removes trailing characters (default is whitespace, or as specified by `value`) from a text string. Mutates the variable directly.
|
|
602
|
+
|
|
603
|
+
```xs
|
|
604
|
+
text.rtrim $user_input {
|
|
605
|
+
value = " "
|
|
606
|
+
}
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
### text.append
|
|
610
|
+
|
|
611
|
+
Adds the specified value to the end of a text string. Mutates the variable directly.
|
|
612
|
+
|
|
613
|
+
```xs
|
|
614
|
+
text.append $greeting {
|
|
615
|
+
value = ", welcome!"
|
|
616
|
+
}
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### text.prepend
|
|
620
|
+
|
|
621
|
+
Adds the specified value to the beginning of a text string. Mutates the variable directly.
|
|
622
|
+
|
|
623
|
+
```xs
|
|
624
|
+
text.prepend $message {
|
|
625
|
+
value = "Alert: "
|
|
626
|
+
}
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
---
|
|
630
|
+
|
|
631
|
+
## Math Functions
|
|
632
|
+
|
|
633
|
+
Statement-level functions for arithmetic and bitwise operations within stacks. These mutate the target variable directly and do not return a value.
|
|
634
|
+
|
|
635
|
+
> **Note:** These are different from math filters (e.g., `$x|add:5`) and math domain functions (e.g., `math.add(5, 3)`). Statement-level math functions modify the variable in place.
|
|
636
|
+
|
|
637
|
+
### math.add
|
|
638
|
+
|
|
639
|
+
Adds the specified value to the variable.
|
|
640
|
+
|
|
641
|
+
```xs
|
|
642
|
+
math.add $cart_total {
|
|
643
|
+
value = $item_price
|
|
644
|
+
}
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
### math.sub
|
|
648
|
+
|
|
649
|
+
Subtracts the specified value from the variable.
|
|
650
|
+
|
|
651
|
+
```xs
|
|
652
|
+
math.sub $total_cost {
|
|
653
|
+
value = $discount_amount
|
|
654
|
+
}
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### math.mul
|
|
658
|
+
|
|
659
|
+
Multiplies the variable by the specified value.
|
|
660
|
+
|
|
661
|
+
```xs
|
|
662
|
+
math.mul $base_price {
|
|
663
|
+
value = $tax_rate
|
|
664
|
+
}
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
### math.div
|
|
668
|
+
|
|
669
|
+
Divides the variable by the specified value.
|
|
670
|
+
|
|
671
|
+
```xs
|
|
672
|
+
math.div $total_time {
|
|
673
|
+
value = $num_tasks
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
### math.bitwise.and
|
|
678
|
+
|
|
679
|
+
Performs a bitwise AND operation on the variable.
|
|
680
|
+
|
|
681
|
+
```xs
|
|
682
|
+
math.bitwise.and $status_flags {
|
|
683
|
+
value = $check_bit
|
|
684
|
+
}
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
### math.bitwise.or
|
|
688
|
+
|
|
689
|
+
Performs a bitwise OR operation on the variable.
|
|
690
|
+
|
|
691
|
+
```xs
|
|
692
|
+
math.bitwise.or $permissions {
|
|
693
|
+
value = $new_permission
|
|
694
|
+
}
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
### math.bitwise.xor
|
|
698
|
+
|
|
699
|
+
Performs a bitwise XOR operation on the variable.
|
|
700
|
+
|
|
701
|
+
```xs
|
|
702
|
+
math.bitwise.xor $flags {
|
|
703
|
+
value = $toggle_bit
|
|
704
|
+
}
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
---
|
|
708
|
+
|
|
709
|
+
## Object Functions
|
|
710
|
+
|
|
711
|
+
Statement-level functions for extracting object properties within stacks. These return results via the `as` variable.
|
|
712
|
+
|
|
713
|
+
### object.keys
|
|
714
|
+
|
|
715
|
+
Retrieves the property keys of an object as an array.
|
|
716
|
+
|
|
717
|
+
```xs
|
|
718
|
+
object.keys {
|
|
719
|
+
value = $user_data
|
|
720
|
+
} as $user_data_keys
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
### object.values
|
|
724
|
+
|
|
725
|
+
Extracts the values of an object's properties into an array.
|
|
726
|
+
|
|
727
|
+
```xs
|
|
728
|
+
object.values {
|
|
729
|
+
value = $product_info
|
|
730
|
+
} as $product_values
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
### object.entries
|
|
734
|
+
|
|
735
|
+
Returns an array of key-value pairs from an object.
|
|
736
|
+
|
|
737
|
+
```xs
|
|
738
|
+
object.entries {
|
|
739
|
+
value = $settings
|
|
740
|
+
} as $settings_pairs
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
---
|
|
744
|
+
|
|
338
745
|
## Object Filters
|
|
339
746
|
|
|
340
747
|
| Filter | Example | Result |
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formatting utilities for Run API documentation output
|
|
3
|
-
* Re-exports the shared formatter with Run API configuration
|
|
4
|
-
*/
|
|
5
|
-
import type { TopicDoc, DetailLevel } from "../meta_api_docs/types.js";
|
|
6
|
-
export declare function formatDocumentation(doc: TopicDoc, detailLevel?: DetailLevel, includeSchemas?: boolean): string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formatting utilities for Run API documentation output
|
|
3
|
-
* Re-exports the shared formatter with Run API configuration
|
|
4
|
-
*/
|
|
5
|
-
import { formatDocumentation as formatDoc, RUN_API_CONFIG, } from "../meta_api_docs/format.js";
|
|
6
|
-
export function formatDocumentation(doc, detailLevel = "detailed", includeSchemas = true) {
|
|
7
|
-
return formatDoc(doc, detailLevel, includeSchemas, RUN_API_CONFIG);
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { formatDocumentation } from "./format.js";
|
|
3
|
-
describe("run_api_docs/format", () => {
|
|
4
|
-
describe("formatDocumentation", () => {
|
|
5
|
-
const minimalDoc = {
|
|
6
|
-
topic: "test",
|
|
7
|
-
title: "Test Topic",
|
|
8
|
-
description: "A test topic description",
|
|
9
|
-
};
|
|
10
|
-
it("should use Run API config by default", () => {
|
|
11
|
-
const docWithEndpoints = {
|
|
12
|
-
...minimalDoc,
|
|
13
|
-
endpoints: [
|
|
14
|
-
{
|
|
15
|
-
method: "GET",
|
|
16
|
-
path: "/test",
|
|
17
|
-
description: "Test endpoint",
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
};
|
|
21
|
-
const result = formatDocumentation(docWithEndpoints);
|
|
22
|
-
expect(result).toContain("https://app.dev.xano.com/api:run/");
|
|
23
|
-
expect(result).toContain("NOT your Xano instance URL");
|
|
24
|
-
});
|
|
25
|
-
it("should format documentation with title", () => {
|
|
26
|
-
const result = formatDocumentation(minimalDoc);
|
|
27
|
-
expect(result).toContain("# Test Topic");
|
|
28
|
-
});
|
|
29
|
-
it("should format documentation with description", () => {
|
|
30
|
-
const result = formatDocumentation(minimalDoc);
|
|
31
|
-
expect(result).toContain("A test topic description");
|
|
32
|
-
});
|
|
33
|
-
it("should respect detail level", () => {
|
|
34
|
-
const docWithExamples = {
|
|
35
|
-
...minimalDoc,
|
|
36
|
-
examples: [
|
|
37
|
-
{
|
|
38
|
-
title: "Example",
|
|
39
|
-
description: "Test",
|
|
40
|
-
request: { method: "GET", path: "/test" },
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
};
|
|
44
|
-
const overviewResult = formatDocumentation(docWithExamples, "overview");
|
|
45
|
-
expect(overviewResult).not.toContain("## Examples");
|
|
46
|
-
const detailedResult = formatDocumentation(docWithExamples, "detailed");
|
|
47
|
-
expect(detailedResult).toContain("## Examples");
|
|
48
|
-
});
|
|
49
|
-
it("should use run_api_docs in related topics", () => {
|
|
50
|
-
const docWithRelated = {
|
|
51
|
-
...minimalDoc,
|
|
52
|
-
related_topics: ["session", "history"],
|
|
53
|
-
};
|
|
54
|
-
const result = formatDocumentation(docWithRelated);
|
|
55
|
-
expect(result).toContain("run_api_docs");
|
|
56
|
-
expect(result).toContain("session, history");
|
|
57
|
-
});
|
|
58
|
-
it("should default to detailed level", () => {
|
|
59
|
-
const docWithEndpoints = {
|
|
60
|
-
...minimalDoc,
|
|
61
|
-
endpoints: [
|
|
62
|
-
{
|
|
63
|
-
method: "GET",
|
|
64
|
-
path: "/test",
|
|
65
|
-
description: "Test",
|
|
66
|
-
parameters: [
|
|
67
|
-
{ name: "id", type: "string", description: "ID" },
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
};
|
|
72
|
-
const result = formatDocumentation(docWithEndpoints);
|
|
73
|
-
expect(result).toContain("**Parameters:**");
|
|
74
|
-
});
|
|
75
|
-
it("should default to including schemas", () => {
|
|
76
|
-
const docWithSchemas = {
|
|
77
|
-
...minimalDoc,
|
|
78
|
-
schemas: {
|
|
79
|
-
TestSchema: { type: "object" },
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
const result = formatDocumentation(docWithSchemas);
|
|
83
|
-
expect(result).toContain("## Schemas");
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Xano Run API Documentation Index
|
|
3
|
-
*
|
|
4
|
-
* This module exports all documentation topics and provides
|
|
5
|
-
* the run_api_docs tool handler for the MCP server.
|
|
6
|
-
*/
|
|
7
|
-
import type { TopicDoc } from "../meta_api_docs/types.js";
|
|
8
|
-
/**
|
|
9
|
-
* All available documentation topics
|
|
10
|
-
*/
|
|
11
|
-
export declare const topics: Record<string, TopicDoc>;
|
|
12
|
-
/**
|
|
13
|
-
* Get list of all available topic names
|
|
14
|
-
*/
|
|
15
|
-
export declare function getTopicNames(): string[];
|
|
16
|
-
/**
|
|
17
|
-
* Get topic descriptions for tool documentation
|
|
18
|
-
*/
|
|
19
|
-
export declare function getTopicDescriptions(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Handler for the run_api_docs tool
|
|
22
|
-
*/
|
|
23
|
-
export declare function handleRunApiDocs(topic?: string, detailLevel?: string, includeSchemas?: boolean): string;
|
|
24
|
-
/**
|
|
25
|
-
* Tool definition for MCP server
|
|
26
|
-
*/
|
|
27
|
-
export declare const runApiDocsToolDefinition: {
|
|
28
|
-
name: string;
|
|
29
|
-
description: string;
|
|
30
|
-
inputSchema: {
|
|
31
|
-
type: string;
|
|
32
|
-
properties: {
|
|
33
|
-
topic: {
|
|
34
|
-
type: string;
|
|
35
|
-
enum: string[];
|
|
36
|
-
description: string;
|
|
37
|
-
};
|
|
38
|
-
detail_level: {
|
|
39
|
-
type: string;
|
|
40
|
-
enum: string[];
|
|
41
|
-
default: string;
|
|
42
|
-
description: string;
|
|
43
|
-
};
|
|
44
|
-
include_schemas: {
|
|
45
|
-
type: string;
|
|
46
|
-
default: boolean;
|
|
47
|
-
description: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
required: string[];
|
|
51
|
-
};
|
|
52
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Xano Run API Documentation Index
|
|
3
|
-
*
|
|
4
|
-
* This module exports all documentation topics and provides
|
|
5
|
-
* the run_api_docs tool handler for the MCP server.
|
|
6
|
-
*/
|
|
7
|
-
import { formatDocumentation } from "./format.js";
|
|
8
|
-
// Import all topic documentation
|
|
9
|
-
import { startDoc } from "./topics/start.js";
|
|
10
|
-
import { runDoc } from "./topics/run.js";
|
|
11
|
-
import { sessionDoc } from "./topics/session.js";
|
|
12
|
-
import { historyDoc } from "./topics/history.js";
|
|
13
|
-
import { dataDoc } from "./topics/data.js";
|
|
14
|
-
import { workflowsDoc } from "./topics/workflows.js";
|
|
15
|
-
/**
|
|
16
|
-
* All available documentation topics
|
|
17
|
-
*/
|
|
18
|
-
export const topics = {
|
|
19
|
-
start: startDoc,
|
|
20
|
-
run: runDoc,
|
|
21
|
-
session: sessionDoc,
|
|
22
|
-
history: historyDoc,
|
|
23
|
-
data: dataDoc,
|
|
24
|
-
workflows: workflowsDoc,
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Get list of all available topic names
|
|
28
|
-
*/
|
|
29
|
-
export function getTopicNames() {
|
|
30
|
-
return Object.keys(topics);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Get topic descriptions for tool documentation
|
|
34
|
-
*/
|
|
35
|
-
export function getTopicDescriptions() {
|
|
36
|
-
return Object.entries(topics)
|
|
37
|
-
.map(([key, doc]) => `- ${key}: ${doc.title}`)
|
|
38
|
-
.join("\n");
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Handler for the run_api_docs tool
|
|
42
|
-
*/
|
|
43
|
-
export function handleRunApiDocs(topic, detailLevel, includeSchemas) {
|
|
44
|
-
// Validate topic
|
|
45
|
-
if (!topic || !topics[topic]) {
|
|
46
|
-
const available = getTopicNames().join(", ");
|
|
47
|
-
return `Error: Unknown topic "${topic}".\n\nAvailable topics: ${available}`;
|
|
48
|
-
}
|
|
49
|
-
const doc = topics[topic];
|
|
50
|
-
return formatDocumentation(doc, detailLevel || "detailed", includeSchemas !== false);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Tool definition for MCP server
|
|
54
|
-
*/
|
|
55
|
-
export const runApiDocsToolDefinition = {
|
|
56
|
-
name: "run_api_docs",
|
|
57
|
-
description: `Get documentation for Xano's Run API. Use this to understand runtime execution, session management, and XanoScript execution.
|
|
58
|
-
|
|
59
|
-
**Important:** The Run API uses a fixed base URL: https://app.dev.xano.com/api:run/<endpoint> (NOT your Xano instance URL)
|
|
60
|
-
|
|
61
|
-
## Topics
|
|
62
|
-
${getTopicDescriptions()}
|
|
63
|
-
|
|
64
|
-
## Usage
|
|
65
|
-
- Start with "start" topic for overview and getting started
|
|
66
|
-
- Use "workflows" for step-by-step guides
|
|
67
|
-
- Use specific topics (run, session, etc.) for detailed endpoint docs`,
|
|
68
|
-
inputSchema: {
|
|
69
|
-
type: "object",
|
|
70
|
-
properties: {
|
|
71
|
-
topic: {
|
|
72
|
-
type: "string",
|
|
73
|
-
enum: getTopicNames(),
|
|
74
|
-
description: "Documentation topic to retrieve",
|
|
75
|
-
},
|
|
76
|
-
detail_level: {
|
|
77
|
-
type: "string",
|
|
78
|
-
enum: ["overview", "detailed", "examples"],
|
|
79
|
-
default: "detailed",
|
|
80
|
-
description: "Level of detail: overview (brief), detailed (full docs), examples (with code examples)",
|
|
81
|
-
},
|
|
82
|
-
include_schemas: {
|
|
83
|
-
type: "boolean",
|
|
84
|
-
default: true,
|
|
85
|
-
description: "Include JSON schemas for requests/responses",
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
required: ["topic"],
|
|
89
|
-
},
|
|
90
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|