@xano/developer-mcp 1.0.75 → 2.0.0

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 (127) hide show
  1. package/README.md +104 -37
  2. package/dist/cli_docs/index.d.ts +13 -37
  3. package/dist/cli_docs/index.js +28 -39
  4. package/dist/cli_docs/topics/integration.js +1 -1
  5. package/dist/cli_docs/topics/workspace.js +1 -1
  6. package/dist/index.js +58 -55
  7. package/dist/lib.d.ts +3 -1
  8. package/dist/lib.js +1 -1
  9. package/dist/meta_api_docs/format.js +1 -1
  10. package/dist/meta_api_docs/index.d.ts +14 -42
  11. package/dist/meta_api_docs/index.js +34 -46
  12. package/dist/tools/cli_docs.d.ts +2 -3
  13. package/dist/tools/cli_docs.js +3 -5
  14. package/dist/tools/define_tool.d.ts +47 -0
  15. package/dist/tools/define_tool.js +36 -0
  16. package/dist/tools/index.d.ts +88 -221
  17. package/dist/tools/index.js +80 -109
  18. package/dist/tools/mcp_version.d.ts +4 -25
  19. package/dist/tools/mcp_version.js +12 -19
  20. package/dist/tools/meta_api_docs.d.ts +2 -3
  21. package/dist/tools/meta_api_docs.js +3 -5
  22. package/dist/tools/validate_xanoscript.d.ts +18 -65
  23. package/dist/tools/validate_xanoscript.js +56 -54
  24. package/dist/tools/xanoscript_docs.d.ts +25 -74
  25. package/dist/tools/xanoscript_docs.js +86 -83
  26. package/dist/xanoscript_docs/README.md +5 -5
  27. package/dist/xanoscript_docs/apis.md +2 -2
  28. package/dist/xanoscript_docs/database.md +1 -1
  29. package/dist/xanoscript_docs/essentials.md +6 -6
  30. package/dist/xanoscript_docs/functions.md +3 -3
  31. package/dist/xanoscript_docs/integrations.md +5 -5
  32. package/dist/xanoscript_docs/middleware.md +1 -1
  33. package/dist/xanoscript_docs/performance.md +4 -4
  34. package/dist/xanoscript_docs/realtime.md +2 -2
  35. package/dist/xanoscript_docs/security.md +1 -1
  36. package/dist/xanoscript_docs/survival.md +1 -1
  37. package/dist/xanoscript_docs/syntax/string-filters.md +1 -1
  38. package/dist/xanoscript_docs/syntax.md +9 -9
  39. package/dist/xanoscript_docs/tools.md +2 -2
  40. package/dist/xanoscript_docs/types.md +2 -2
  41. package/dist/xanoscript_docs/unit-testing.md +1 -1
  42. package/dist/xanoscript_docs/workflow-tests.md +1 -1
  43. package/dist/xanoscript_docs/working.md +4 -4
  44. package/package.json +5 -4
  45. package/dist/api_docs/format.d.ts +0 -5
  46. package/dist/api_docs/format.js +0 -171
  47. package/dist/api_docs/index.d.ts +0 -52
  48. package/dist/api_docs/index.js +0 -111
  49. package/dist/api_docs/topics/agent.d.ts +0 -2
  50. package/dist/api_docs/topics/agent.js +0 -142
  51. package/dist/api_docs/topics/api.d.ts +0 -2
  52. package/dist/api_docs/topics/api.js +0 -176
  53. package/dist/api_docs/topics/apigroup.d.ts +0 -2
  54. package/dist/api_docs/topics/apigroup.js +0 -124
  55. package/dist/api_docs/topics/authentication.d.ts +0 -2
  56. package/dist/api_docs/topics/authentication.js +0 -61
  57. package/dist/api_docs/topics/branch.d.ts +0 -2
  58. package/dist/api_docs/topics/branch.js +0 -73
  59. package/dist/api_docs/topics/file.d.ts +0 -2
  60. package/dist/api_docs/topics/file.js +0 -70
  61. package/dist/api_docs/topics/function.d.ts +0 -2
  62. package/dist/api_docs/topics/function.js +0 -164
  63. package/dist/api_docs/topics/history.d.ts +0 -2
  64. package/dist/api_docs/topics/history.js +0 -149
  65. package/dist/api_docs/topics/mcp_server.d.ts +0 -2
  66. package/dist/api_docs/topics/mcp_server.js +0 -139
  67. package/dist/api_docs/topics/middleware.d.ts +0 -2
  68. package/dist/api_docs/topics/middleware.js +0 -156
  69. package/dist/api_docs/topics/realtime.d.ts +0 -2
  70. package/dist/api_docs/topics/realtime.js +0 -112
  71. package/dist/api_docs/topics/start.d.ts +0 -2
  72. package/dist/api_docs/topics/start.js +0 -107
  73. package/dist/api_docs/topics/table.d.ts +0 -2
  74. package/dist/api_docs/topics/table.js +0 -195
  75. package/dist/api_docs/topics/task.d.ts +0 -2
  76. package/dist/api_docs/topics/task.js +0 -165
  77. package/dist/api_docs/topics/tool.d.ts +0 -2
  78. package/dist/api_docs/topics/tool.js +0 -150
  79. package/dist/api_docs/topics/workflows.d.ts +0 -2
  80. package/dist/api_docs/topics/workflows.js +0 -131
  81. package/dist/api_docs/topics/workspace.d.ts +0 -2
  82. package/dist/api_docs/topics/workspace.js +0 -153
  83. package/dist/api_docs/types.d.ts +0 -79
  84. package/dist/api_docs/types.js +0 -4
  85. package/dist/cli_docs/topics/run.d.ts +0 -2
  86. package/dist/cli_docs/topics/run.js +0 -248
  87. package/dist/meta_api_docs/format.test.d.ts +0 -1
  88. package/dist/meta_api_docs/format.test.js +0 -272
  89. package/dist/meta_api_docs/index.test.d.ts +0 -1
  90. package/dist/meta_api_docs/index.test.js +0 -128
  91. package/dist/meta_api_docs/types.test.d.ts +0 -1
  92. package/dist/meta_api_docs/types.test.js +0 -132
  93. package/dist/templates/init-workspace.d.ts +0 -10
  94. package/dist/templates/init-workspace.js +0 -278
  95. package/dist/templates/xanoscript-index.d.ts +0 -11
  96. package/dist/templates/xanoscript-index.js +0 -72
  97. package/dist/tools/index.test.d.ts +0 -1
  98. package/dist/tools/index.test.js +0 -179
  99. package/dist/tools/xanoscript_docs.test.d.ts +0 -1
  100. package/dist/tools/xanoscript_docs.test.js +0 -197
  101. package/dist/xanoscript.test.d.ts +0 -1
  102. package/dist/xanoscript.test.js +0 -421
  103. package/dist/xanoscript_docs/cheatsheet.md +0 -287
  104. package/dist/xanoscript_docs/ephemeral.md +0 -330
  105. package/dist/xanoscript_docs/quickstart.md +0 -692
  106. package/dist/xanoscript_docs/run.md +0 -196
  107. package/dist/xanoscript_docs/schema.md +0 -300
  108. package/dist/xanoscript_docs_auto/README.md +0 -119
  109. package/dist/xanoscript_docs_auto/agents.md +0 -446
  110. package/dist/xanoscript_docs_auto/apis.md +0 -517
  111. package/dist/xanoscript_docs_auto/control-flow.md +0 -543
  112. package/dist/xanoscript_docs_auto/database.md +0 -551
  113. package/dist/xanoscript_docs_auto/debugging.md +0 -527
  114. package/dist/xanoscript_docs_auto/filters.md +0 -464
  115. package/dist/xanoscript_docs_auto/functions.md +0 -431
  116. package/dist/xanoscript_docs_auto/integrations.md +0 -657
  117. package/dist/xanoscript_docs_auto/mcp-servers.md +0 -408
  118. package/dist/xanoscript_docs_auto/operators.md +0 -368
  119. package/dist/xanoscript_docs_auto/syntax.md +0 -287
  120. package/dist/xanoscript_docs_auto/tables.md +0 -447
  121. package/dist/xanoscript_docs_auto/tasks.md +0 -479
  122. package/dist/xanoscript_docs_auto/testing.md +0 -574
  123. package/dist/xanoscript_docs_auto/tools.md +0 -485
  124. package/dist/xanoscript_docs_auto/triggers.md +0 -595
  125. package/dist/xanoscript_docs_auto/types.md +0 -323
  126. package/dist/xanoscript_docs_auto/variables.md +0 -462
  127. package/dist/xanoscript_docs_auto/version.json +0 -5
@@ -1,431 +0,0 @@
1
- ---
2
- applyTo: "functions/**/*.xs"
3
- ---
4
-
5
- # Functions
6
-
7
- Reusable function stacks with inputs, processing logic, and responses.
8
-
9
- ## Quick Reference
10
-
11
- ```xs
12
- function "<name>" {
13
- input {
14
- text name
15
- int? age
16
- }
17
- stack {
18
- // Processing logic
19
- var $result { value = $input.name|to_upper }
20
- }
21
- response = $result
22
- }
23
- ```
24
-
25
- ### Function Invocation
26
- ```xs
27
- function.run "<name>" {
28
- input = { name: "John", age: 25 }
29
- } as $result
30
- ```
31
-
32
- ---
33
-
34
- ## Function Definition
35
-
36
- ### Basic Function
37
-
38
- ```xs
39
- function "greet" {
40
- input {
41
- text name filters=trim
42
- }
43
- stack {
44
- var $greeting {
45
- value = "Hello, " ~ $input.name ~ "!"
46
- }
47
- }
48
- response = $greeting
49
- }
50
- ```
51
-
52
- ### Function with Optional Inputs
53
-
54
- ```xs
55
- function "calculate_total" {
56
- input {
57
- decimal price
58
- int quantity default=1
59
- decimal? discount
60
- }
61
- stack {
62
- var $subtotal {
63
- value = $input.price * $input.quantity
64
- }
65
- var $total {
66
- value = $input.discount != null
67
- ? $subtotal - $input.discount
68
- : $subtotal
69
- }
70
- }
71
- response = $total
72
- }
73
- ```
74
-
75
- ### Function with Complex Response
76
-
77
- ```xs
78
- function "get_user_summary" {
79
- input {
80
- int user_id
81
- }
82
- stack {
83
- db.get user {
84
- field_name = "id"
85
- field_value = $input.user_id
86
- } as $user
87
-
88
- db.query order {
89
- where = $db.order.user_id == $input.user_id
90
- return = {type: "count"}
91
- } as $order_count
92
- }
93
- response = {
94
- user: $user,
95
- total_orders: $order_count
96
- }
97
- }
98
- ```
99
-
100
- ---
101
-
102
- ## Calling Functions
103
-
104
- ### Basic Call
105
-
106
- ```xs
107
- function.run "greet" {
108
- input = {name: "Alice"}
109
- } as $greeting
110
- ```
111
-
112
- ### With Dynamic Input
113
-
114
- ```xs
115
- function.run "calculate_total" {
116
- input = {
117
- price: $input.price,
118
- quantity: $input.qty,
119
- discount: $input.coupon_value
120
- }
121
- } as $total
122
- ```
123
-
124
- ### Error Handling
125
-
126
- ```xs
127
- try_catch {
128
- try {
129
- function.run "risky_operation" {
130
- input = {data: $input.data}
131
- } as $result
132
- }
133
- catch {
134
- var $result { value = null }
135
- debug.log { value = "Operation failed: " ~ $error.message }
136
- }
137
- }
138
- ```
139
-
140
- ---
141
-
142
- ## Function Blocks
143
-
144
- ### Input Block
145
-
146
- Define typed parameters with validation:
147
-
148
- ```xs
149
- input {
150
- // Required parameters
151
- text name filters=trim|min:1|max:100
152
- email user_email filters=trim|lower
153
- int quantity filters=min:1
154
-
155
- // Optional parameters
156
- text? notes
157
- int? priority default=1
158
-
159
- // Complex types
160
- json metadata
161
- array<text> tags
162
- file attachment
163
- }
164
- ```
165
-
166
- ### Stack Block
167
-
168
- Container for sequential operations:
169
-
170
- ```xs
171
- stack {
172
- // Variables
173
- var $count { value = 0 }
174
-
175
- // Database operations
176
- db.query user {} as $users
177
-
178
- // Control flow
179
- conditional {
180
- if ($users|count > 0) {
181
- var.update $count { value = $users|count }
182
- }
183
- }
184
-
185
- // Function calls
186
- function.run "helper" {
187
- input = {data: $users}
188
- } as $processed
189
- }
190
- ```
191
-
192
- ### Response Block
193
-
194
- Define the return value:
195
-
196
- ```xs
197
- // Simple response
198
- response = $result
199
-
200
- // Object response
201
- response = {
202
- data: $users,
203
- count: $total,
204
- page: $input.page
205
- }
206
-
207
- // Conditional response
208
- response = $success ? $data : null
209
- ```
210
-
211
- ---
212
-
213
- ## Async Operations
214
-
215
- ### Sequential Execution
216
-
217
- ```xs
218
- stack {
219
- // These run in sequence
220
- function.run "step1" { input = {} } as $r1
221
- function.run "step2" { input = {prev: $r1} } as $r2
222
- function.run "step3" { input = {prev: $r2} } as $r3
223
- }
224
- ```
225
-
226
- ### Parallel Execution
227
-
228
- Use array operations for parallel processing:
229
-
230
- ```xs
231
- stack {
232
- var $ids { value = [1, 2, 3, 4, 5] }
233
-
234
- array.map {
235
- array = $ids
236
- run {
237
- function.run "process_item" {
238
- input = {id: $this}
239
- } as $result
240
- }
241
- } as $results
242
- }
243
- ```
244
-
245
- ---
246
-
247
- ## Loops in Functions
248
-
249
- ### For Loop (Fixed Count)
250
-
251
- ```xs
252
- for (10) {
253
- each as $index {
254
- var.update $total { value = $total + $index }
255
- }
256
- }
257
- ```
258
-
259
- ### Foreach Loop (Array Iteration)
260
-
261
- ```xs
262
- foreach ($input.items) {
263
- each as $item {
264
- function.run "process" {
265
- input = {item: $item}
266
- } as $processed
267
-
268
- array.push {
269
- array = $results
270
- value = $processed
271
- }
272
- }
273
- }
274
- ```
275
-
276
- ### While Loop (Condition)
277
-
278
- ```xs
279
- var $counter { value = 0 }
280
- var $max { value = 10 }
281
-
282
- while ($counter < $max) {
283
- each {
284
- var.update $counter { value = $counter + 1 }
285
- // Process iteration
286
- }
287
- }
288
- ```
289
-
290
- ---
291
-
292
- ## Testing Functions
293
-
294
- ### Test Block
295
-
296
- ```xs
297
- function "add_numbers" {
298
- input {
299
- int a
300
- int b
301
- }
302
- stack {
303
- var $sum { value = $input.a + $input.b }
304
- }
305
- response = $sum
306
-
307
- test "adds positive numbers" {
308
- function.call {
309
- input = {a: 2, b: 3}
310
- } as $result
311
-
312
- expect.to_equal {
313
- input = $result
314
- value = 5
315
- }
316
- }
317
-
318
- test "handles zero" {
319
- function.call {
320
- input = {a: 5, b: 0}
321
- } as $result
322
-
323
- expect.to_equal {
324
- input = $result
325
- value = 5
326
- }
327
- }
328
- }
329
- ```
330
-
331
- ### Assertions
332
-
333
- ```xs
334
- expect.to_be_true { input = $value }
335
- expect.to_be_false { input = $value }
336
- expect.to_equal { input = $a, value = $b }
337
- expect.to_not_equal { input = $a, value = $b }
338
- expect.to_be_null { input = $value }
339
- expect.to_not_be_null { input = $value }
340
- expect.to_contain { input = $array, value = $item }
341
- expect.to_be_greater_than { input = $a, value = $b }
342
- expect.to_be_less_than { input = $a, value = $b }
343
- ```
344
-
345
- ---
346
-
347
- ## Function Best Practices
348
-
349
- ### Keep Functions Focused
350
-
351
- ```xs
352
- // Good: Single responsibility
353
- function "validate_email" {
354
- input { email value }
355
- stack {
356
- var $valid {
357
- value = $input.value|regex_matches:"^[^@]+@[^@]+\.[^@]+$"
358
- }
359
- }
360
- response = $valid
361
- }
362
-
363
- // Good: Compose small functions
364
- function "process_user" {
365
- input { json user_data }
366
- stack {
367
- function.run "validate_email" {
368
- input = {value: $input.user_data.email}
369
- } as $email_valid
370
-
371
- function.run "validate_name" {
372
- input = {value: $input.user_data.name}
373
- } as $name_valid
374
- }
375
- response = {
376
- valid: $email_valid && $name_valid
377
- }
378
- }
379
- ```
380
-
381
- ### Use Descriptive Names
382
-
383
- ```xs
384
- // Good naming
385
- function "calculate_order_total" { ... }
386
- function "send_welcome_email" { ... }
387
- function "generate_invoice_pdf" { ... }
388
- ```
389
-
390
- ### Handle Errors Gracefully
391
-
392
- ```xs
393
- function "fetch_user" {
394
- input { int user_id }
395
- stack {
396
- db.get user {
397
- field_name = "id"
398
- field_value = $input.user_id
399
- } as $user
400
-
401
- precondition ($user != null) {
402
- error_type = "notfound"
403
- error = "User not found"
404
- }
405
- }
406
- response = $user
407
- }
408
- ```
409
-
410
- ---
411
-
412
- ## Function Documentation
413
-
414
- Add descriptions to your functions:
415
-
416
- ```xs
417
- function "create_invoice" {
418
- description = "Creates an invoice for an order and sends email notification"
419
-
420
- input {
421
- int order_id description="The order to invoice"
422
- bool? send_email description="Whether to send email" default=true
423
- }
424
-
425
- stack {
426
- // Implementation
427
- }
428
-
429
- response = $invoice
430
- }
431
- ```