@xano/developer-mcp 1.0.21 → 1.0.22

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 (48) hide show
  1. package/README.md +100 -19
  2. package/dist/index.js +4 -242
  3. package/dist/meta_api_docs/format.d.ts +16 -1
  4. package/dist/meta_api_docs/format.js +24 -6
  5. package/dist/meta_api_docs/format.test.d.ts +1 -0
  6. package/dist/meta_api_docs/format.test.js +274 -0
  7. package/dist/meta_api_docs/index.test.d.ts +1 -0
  8. package/dist/meta_api_docs/index.test.js +128 -0
  9. package/dist/meta_api_docs/types.test.d.ts +1 -0
  10. package/dist/meta_api_docs/types.test.js +132 -0
  11. package/dist/run_api_docs/format.d.ts +1 -0
  12. package/dist/run_api_docs/format.js +3 -170
  13. package/dist/run_api_docs/format.test.d.ts +1 -0
  14. package/dist/run_api_docs/format.test.js +86 -0
  15. package/dist/run_api_docs/index.test.d.ts +1 -0
  16. package/dist/run_api_docs/index.test.js +127 -0
  17. package/dist/xanoscript.d.ts +41 -0
  18. package/dist/xanoscript.js +261 -0
  19. package/dist/xanoscript.test.d.ts +1 -0
  20. package/dist/xanoscript.test.js +303 -0
  21. package/dist/xanoscript_docs/README.md +2 -0
  22. package/dist/xanoscript_docs/agents.md +1 -1
  23. package/dist/xanoscript_docs/functions.md +4 -4
  24. package/dist/xanoscript_docs/integrations.md +43 -1
  25. package/dist/xanoscript_docs/performance.md +1 -1
  26. package/dist/xanoscript_docs/tasks.md +2 -2
  27. package/dist/xanoscript_docs/tools.md +2 -2
  28. package/dist/xanoscript_docs_auto/README.md +119 -0
  29. package/dist/xanoscript_docs_auto/agents.md +446 -0
  30. package/dist/xanoscript_docs_auto/apis.md +517 -0
  31. package/dist/xanoscript_docs_auto/control-flow.md +543 -0
  32. package/dist/xanoscript_docs_auto/database.md +551 -0
  33. package/dist/xanoscript_docs_auto/debugging.md +527 -0
  34. package/dist/xanoscript_docs_auto/filters.md +464 -0
  35. package/dist/xanoscript_docs_auto/functions.md +431 -0
  36. package/dist/xanoscript_docs_auto/integrations.md +657 -0
  37. package/dist/xanoscript_docs_auto/mcp-servers.md +408 -0
  38. package/dist/xanoscript_docs_auto/operators.md +368 -0
  39. package/dist/xanoscript_docs_auto/syntax.md +287 -0
  40. package/dist/xanoscript_docs_auto/tables.md +447 -0
  41. package/dist/xanoscript_docs_auto/tasks.md +479 -0
  42. package/dist/xanoscript_docs_auto/testing.md +574 -0
  43. package/dist/xanoscript_docs_auto/tools.md +485 -0
  44. package/dist/xanoscript_docs_auto/triggers.md +595 -0
  45. package/dist/xanoscript_docs_auto/types.md +323 -0
  46. package/dist/xanoscript_docs_auto/variables.md +462 -0
  47. package/dist/xanoscript_docs_auto/version.json +5 -0
  48. package/package.json +6 -2
@@ -0,0 +1,527 @@
1
+ ---
2
+ applyTo: "**/*.xs"
3
+ ---
4
+
5
+ # Debugging
6
+
7
+ Logging, inspecting, and debugging XanoScript execution.
8
+
9
+ ## Quick Reference
10
+
11
+ | Function | Purpose |
12
+ |----------|---------|
13
+ | `debug.log` | Log value to debugger |
14
+ | `debug.stop` | Stop execution and inspect |
15
+ | `precondition` | Assert condition with error |
16
+ | `throw` | Raise custom error |
17
+
18
+ ---
19
+
20
+ ## debug.log
21
+
22
+ Log values during execution:
23
+
24
+ ```xs
25
+ debug.log {
26
+ value = "Processing started"
27
+ }
28
+
29
+ debug.log {
30
+ value = $input
31
+ }
32
+
33
+ debug.log {
34
+ value = {
35
+ user_id: $user.id,
36
+ action: "login",
37
+ timestamp: now
38
+ }
39
+ }
40
+ ```
41
+
42
+ ### Log with Labels
43
+
44
+ ```xs
45
+ debug.log {
46
+ value = "User ID: " ~ $user.id
47
+ }
48
+
49
+ debug.log {
50
+ value = "Items: " ~ ($items|json_encode)
51
+ }
52
+
53
+ debug.log {
54
+ value = "Count: " ~ ($results|count)
55
+ }
56
+ ```
57
+
58
+ ### Log Objects
59
+
60
+ ```xs
61
+ debug.log {
62
+ value = {
63
+ step: "after_validation",
64
+ input: $input,
65
+ user: $user,
66
+ is_valid: $is_valid
67
+ }
68
+ }
69
+ ```
70
+
71
+ ---
72
+
73
+ ## debug.stop
74
+
75
+ Stop execution and inspect state:
76
+
77
+ ```xs
78
+ debug.stop {
79
+ value = "Inspection point"
80
+ }
81
+
82
+ debug.stop {
83
+ value = {
84
+ variables: {
85
+ user: $user,
86
+ items: $items,
87
+ total: $total
88
+ },
89
+ input: $input,
90
+ auth: $auth
91
+ }
92
+ }
93
+ ```
94
+
95
+ ### Conditional Stop
96
+
97
+ ```xs
98
+ conditional {
99
+ if ($suspicious_value) {
100
+ debug.stop {
101
+ value = "Suspicious value detected"
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Preconditions
110
+
111
+ Validate conditions and throw typed errors:
112
+
113
+ ```xs
114
+ precondition ($input.amount > 0) {
115
+ error_type = "inputerror"
116
+ error = "Amount must be positive"
117
+ }
118
+
119
+ precondition ($user != null) {
120
+ error_type = "notfound"
121
+ error = "User not found"
122
+ }
123
+
124
+ precondition ($auth.role == "admin") {
125
+ error_type = "accessdenied"
126
+ error = "Admin access required"
127
+ }
128
+ ```
129
+
130
+ ### Error Types
131
+
132
+ | Type | HTTP Status | Use Case |
133
+ |------|-------------|----------|
134
+ | `inputerror` | 400 | Invalid input |
135
+ | `accessdenied` | 403 | Unauthorized |
136
+ | `notfound` | 404 | Resource missing |
137
+ | `standard` | 500 | General error |
138
+
139
+ ---
140
+
141
+ ## Throwing Errors
142
+
143
+ ### Basic Throw
144
+
145
+ ```xs
146
+ throw {
147
+ name = "ValidationError"
148
+ value = "Email format is invalid"
149
+ }
150
+ ```
151
+
152
+ ### With Error Code
153
+
154
+ ```xs
155
+ throw {
156
+ name = "RateLimitError"
157
+ value = "Too many requests"
158
+ code = 429
159
+ }
160
+ ```
161
+
162
+ ### Conditional Throw
163
+
164
+ ```xs
165
+ conditional {
166
+ if ($user == null) {
167
+ throw {
168
+ name = "UserNotFound"
169
+ value = "User with ID " ~ $input.user_id ~ " not found"
170
+ code = 404
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Try/Catch Debugging
179
+
180
+ ### Log Errors
181
+
182
+ ```xs
183
+ try_catch {
184
+ try {
185
+ function.run "risky_operation" {
186
+ input = $data
187
+ } as $result
188
+ }
189
+ catch {
190
+ debug.log {
191
+ value = {
192
+ error_name: $error.name,
193
+ error_message: $error.message,
194
+ error_code: $error.code,
195
+ input_data: $data
196
+ }
197
+ }
198
+
199
+ // Rethrow or handle
200
+ throw {
201
+ name = $error.name
202
+ value = $error.message
203
+ code = $error.code
204
+ }
205
+ }
206
+ }
207
+ ```
208
+
209
+ ### Error Recovery
210
+
211
+ ```xs
212
+ try_catch {
213
+ try {
214
+ api.request {
215
+ url = $external_api
216
+ timeout = 5000
217
+ } as $response
218
+ }
219
+ catch {
220
+ debug.log {
221
+ value = "External API failed, using fallback"
222
+ }
223
+
224
+ var $response {
225
+ value = {data: [], cached: true}
226
+ }
227
+ }
228
+ }
229
+ ```
230
+
231
+ ---
232
+
233
+ ## Logging Patterns
234
+
235
+ ### Execution Tracing
236
+
237
+ ```xs
238
+ function "process_order" {
239
+ input { int order_id }
240
+ stack {
241
+ debug.log { value = "START: process_order(" ~ $input.order_id ~ ")" }
242
+
243
+ db.get order {
244
+ field_name = "id"
245
+ field_value = $input.order_id
246
+ } as $order
247
+
248
+ debug.log { value = "STEP: Fetched order" }
249
+
250
+ function.run "validate_order" {
251
+ input = {order: $order}
252
+ } as $valid
253
+
254
+ debug.log { value = "STEP: Validation result = " ~ $valid }
255
+
256
+ function.run "charge_payment" {
257
+ input = {order: $order}
258
+ } as $payment
259
+
260
+ debug.log { value = "STEP: Payment charged" }
261
+
262
+ debug.log { value = "END: process_order" }
263
+ }
264
+ response = $payment
265
+ }
266
+ ```
267
+
268
+ ### Performance Logging
269
+
270
+ ```xs
271
+ var $start_time { value = now|to_ms }
272
+
273
+ // Expensive operation
274
+ db.query large_table {
275
+ return = {type: "all"}
276
+ } as $results
277
+
278
+ var $end_time { value = now|to_ms }
279
+ var $duration { value = $end_time - $start_time }
280
+
281
+ debug.log {
282
+ value = "Query took " ~ $duration ~ "ms, returned " ~ ($results|count) ~ " rows"
283
+ }
284
+ ```
285
+
286
+ ### Conditional Logging
287
+
288
+ ```xs
289
+ // Only log in development
290
+ conditional {
291
+ if ($env.DEBUG == "true") {
292
+ debug.log {
293
+ value = $detailed_info
294
+ }
295
+ }
296
+ }
297
+ ```
298
+
299
+ ---
300
+
301
+ ## Database Debugging
302
+
303
+ ### Log Query Results
304
+
305
+ ```xs
306
+ db.query user {
307
+ where = $db.user.active == true
308
+ } as $users
309
+
310
+ debug.log {
311
+ value = {
312
+ query: "active users",
313
+ count: $users|count,
314
+ first_10: $users|slice:0:10
315
+ }
316
+ }
317
+ ```
318
+
319
+ ### Log Mutations
320
+
321
+ ```xs
322
+ db.add user {
323
+ data = $user_data
324
+ } as $new_user
325
+
326
+ debug.log {
327
+ value = {
328
+ action: "user_created",
329
+ id: $new_user.id,
330
+ data: $user_data
331
+ }
332
+ }
333
+ ```
334
+
335
+ ---
336
+
337
+ ## API Debugging
338
+
339
+ ### Log Requests
340
+
341
+ ```xs
342
+ debug.log {
343
+ value = {
344
+ api_call: $external_api,
345
+ method: "POST",
346
+ body: $request_body
347
+ }
348
+ }
349
+
350
+ api.request {
351
+ url = $external_api
352
+ method = "POST"
353
+ body = $request_body
354
+ } as $response
355
+
356
+ debug.log {
357
+ value = {
358
+ api_response: $response,
359
+ status: $response.status
360
+ }
361
+ }
362
+ ```
363
+
364
+ ### Log Authentication
365
+
366
+ ```xs
367
+ debug.log {
368
+ value = {
369
+ auth_info: {
370
+ user_id: $auth.id,
371
+ role: $auth.role,
372
+ ip: $env.$remote_ip
373
+ }
374
+ }
375
+ }
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Debugging Tips
381
+
382
+ ### Isolate Problems
383
+
384
+ ```xs
385
+ // Add log before suspected issue
386
+ debug.log { value = "Before problematic code" }
387
+ debug.log { value = $suspect_variable }
388
+
389
+ // Problematic code
390
+ function.run "suspect_function" {
391
+ input = $suspect_variable
392
+ } as $result
393
+
394
+ // Add log after
395
+ debug.log { value = "After problematic code" }
396
+ debug.log { value = $result }
397
+ ```
398
+
399
+ ### Check Variable Types
400
+
401
+ ```xs
402
+ debug.log {
403
+ value = {
404
+ value: $variable,
405
+ type: $variable|is_array ? "array"
406
+ : $variable|is_object ? "object"
407
+ : $variable|is_int ? "int"
408
+ : $variable|is_text ? "text"
409
+ : $variable|is_null ? "null"
410
+ : "unknown"
411
+ }
412
+ }
413
+ ```
414
+
415
+ ### Log Loop Progress
416
+
417
+ ```xs
418
+ var $index { value = 0 }
419
+
420
+ foreach ($items) {
421
+ each as $item {
422
+ var.update $index { value = $index + 1 }
423
+
424
+ conditional {
425
+ if ($index % 100 == 0) {
426
+ debug.log {
427
+ value = "Processed " ~ $index ~ " of " ~ ($items|count)
428
+ }
429
+ }
430
+ }
431
+ }
432
+ }
433
+ ```
434
+
435
+ ---
436
+
437
+ ## Production Debugging
438
+
439
+ ### Structured Logging
440
+
441
+ ```xs
442
+ db.add log_entry {
443
+ data = {
444
+ level: "error",
445
+ context: "payment_processing",
446
+ message: $error.message,
447
+ data: {
448
+ order_id: $order.id,
449
+ amount: $order.total,
450
+ user_id: $auth.id
451
+ },
452
+ request: {
453
+ method: $env.$request_method,
454
+ uri: $env.$request_uri,
455
+ ip: $env.$remote_ip
456
+ },
457
+ created_at: now
458
+ }
459
+ }
460
+ ```
461
+
462
+ ### Error Reporting
463
+
464
+ ```xs
465
+ try_catch {
466
+ try {
467
+ // Operation
468
+ }
469
+ catch {
470
+ // Log to database
471
+ db.add error_log {
472
+ data = {
473
+ error_name: $error.name,
474
+ error_message: $error.message,
475
+ error_code: $error.code,
476
+ stack_trace: $error.stack,
477
+ context: "api_endpoint",
478
+ user_id: $auth.id,
479
+ request_data: $input|json_encode,
480
+ created_at: now
481
+ }
482
+ }
483
+
484
+ // Alert if critical
485
+ conditional {
486
+ if ($error.code >= 500) {
487
+ util.send_email {
488
+ to = $env.ADMIN_EMAIL
489
+ subject = "Critical Error: " ~ $error.name
490
+ body = $error.message
491
+ }
492
+ }
493
+ }
494
+
495
+ // Rethrow
496
+ throw {
497
+ name = $error.name
498
+ value = $error.message
499
+ code = $error.code
500
+ }
501
+ }
502
+ }
503
+ ```
504
+
505
+ ---
506
+
507
+ ## Disable in Production
508
+
509
+ ### Mock Debug Functions
510
+
511
+ ```xs
512
+ // Wrapper that respects environment
513
+ conditional {
514
+ if ($env.ENVIRONMENT != "production") {
515
+ debug.log { value = $debug_info }
516
+ }
517
+ }
518
+ ```
519
+
520
+ ### Using Disabled Flag
521
+
522
+ ```xs
523
+ debug.log {
524
+ disabled = $env.ENVIRONMENT == "production"
525
+ value = $sensitive_debug_info
526
+ }
527
+ ```