@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,485 @@
1
+ ---
2
+ applyTo: "tools/**/*.xs"
3
+ ---
4
+
5
+ # AI Tools
6
+
7
+ Tool definitions for AI agents and MCP servers.
8
+
9
+ ## Quick Reference
10
+
11
+ ```xs
12
+ tool "<name>" {
13
+ description = "What this tool does"
14
+ input {
15
+ text parameter_name description="Parameter description"
16
+ }
17
+ stack {
18
+ // Tool implementation
19
+ }
20
+ response = $result
21
+ }
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Tool Definition
27
+
28
+ ### Basic Tool
29
+
30
+ ```xs
31
+ tool "get_weather" {
32
+ description = "Get current weather for a location"
33
+ input {
34
+ text city description="City name"
35
+ text? country description="Country code (optional)"
36
+ }
37
+ stack {
38
+ api.request {
39
+ url = "https://api.weather.com/current"
40
+ params = {
41
+ city: $input.city,
42
+ country: $input.country ?? "US"
43
+ }
44
+ headers = {
45
+ "Authorization": "Bearer " ~ $env.WEATHER_API_KEY
46
+ }
47
+ } as $weather
48
+ }
49
+ response = {
50
+ city: $input.city,
51
+ temperature: $weather.temp,
52
+ conditions: $weather.conditions
53
+ }
54
+ }
55
+ ```
56
+
57
+ ### Database Query Tool
58
+
59
+ ```xs
60
+ tool "search_products" {
61
+ description = "Search for products by name or category"
62
+ input {
63
+ text? query description="Search query"
64
+ text? category description="Product category"
65
+ int? limit description="Maximum results" default=10
66
+ }
67
+ stack {
68
+ db.query product {
69
+ where = $db.product.active == true
70
+ && $db.product.name ilike? ("%" ~ $input.query ~ "%")
71
+ && $db.product.category ==? $input.category
72
+ order_by = {field: "name", direction: "asc"}
73
+ return = {type: "list", paging: {per_page: $input.limit}}
74
+ } as $products
75
+ }
76
+ response = $products|map:{
77
+ id: $$.id,
78
+ name: $$.name,
79
+ price: $$.price,
80
+ stock: $$.stock
81
+ }
82
+ }
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Tool Input Parameters
88
+
89
+ ### Required Parameters
90
+
91
+ ```xs
92
+ input {
93
+ text name description="User's full name"
94
+ email email description="User's email address"
95
+ int quantity description="Number of items"
96
+ }
97
+ ```
98
+
99
+ ### Optional Parameters
100
+
101
+ ```xs
102
+ input {
103
+ text query description="Search query"
104
+ text? category description="Filter by category"
105
+ int? limit description="Max results" default=20
106
+ text? sort description="Sort field" default="created_at"
107
+ }
108
+ ```
109
+
110
+ ### Complex Types
111
+
112
+ ```xs
113
+ input {
114
+ json filters description="Filter criteria object"
115
+ array<text> tags description="Tags to filter by"
116
+ object options description="Additional options"
117
+ }
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Tool Responses
123
+
124
+ ### Simple Response
125
+
126
+ ```xs
127
+ response = $result
128
+ ```
129
+
130
+ ### Structured Response
131
+
132
+ ```xs
133
+ response = {
134
+ success: true,
135
+ data: $result,
136
+ count: $result|count
137
+ }
138
+ ```
139
+
140
+ ### Mapped Response
141
+
142
+ ```xs
143
+ response = $items|map:{
144
+ id: $$.id,
145
+ name: $$.name,
146
+ summary: $$.description|substr:0:100
147
+ }
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Common Tool Patterns
153
+
154
+ ### Lookup Tool
155
+
156
+ ```xs
157
+ tool "get_order" {
158
+ description = "Get order details by order number"
159
+ input {
160
+ text order_number description="The order number to look up"
161
+ }
162
+ stack {
163
+ db.get order {
164
+ field_name = "order_number"
165
+ field_value = $input.order_number
166
+ addons = [order_items, shipping_address]
167
+ } as $order
168
+
169
+ conditional {
170
+ if ($order == null) {
171
+ return {
172
+ value = {error: "Order not found"}
173
+ }
174
+ }
175
+ }
176
+ }
177
+ response = {
178
+ order_number: $order.order_number,
179
+ status: $order.status,
180
+ total: $order.total,
181
+ items: $order.order_items,
182
+ shipping: $order.shipping_address
183
+ }
184
+ }
185
+ ```
186
+
187
+ ### Search Tool
188
+
189
+ ```xs
190
+ tool "search_knowledge_base" {
191
+ description = "Search the knowledge base for articles"
192
+ input {
193
+ text query description="Search query"
194
+ int? limit description="Maximum results" default=5
195
+ }
196
+ stack {
197
+ db.query article {
198
+ where = $db.article.published == true
199
+ && ($db.article.title ilike ("%" ~ $input.query ~ "%")
200
+ || $db.article.content search $input.query)
201
+ order_by = {field: "relevance", direction: "desc"}
202
+ return = {type: "list", paging: {per_page: $input.limit}}
203
+ } as $articles
204
+ }
205
+ response = $articles|map:{
206
+ title: $$.title,
207
+ summary: $$.content|substr:0:200,
208
+ url: "/articles/" ~ $$.slug
209
+ }
210
+ }
211
+ ```
212
+
213
+ ### Action Tool
214
+
215
+ ```xs
216
+ tool "create_ticket" {
217
+ description = "Create a support ticket"
218
+ input {
219
+ text subject description="Ticket subject"
220
+ text description description="Detailed description"
221
+ text? priority description="Priority level" default="normal"
222
+ }
223
+ stack {
224
+ db.add ticket {
225
+ data = {
226
+ subject: $input.subject,
227
+ description: $input.description,
228
+ priority: $input.priority,
229
+ status: "open",
230
+ created_at: now
231
+ }
232
+ } as $ticket
233
+ }
234
+ response = {
235
+ ticket_id: $ticket.id,
236
+ message: "Ticket created successfully"
237
+ }
238
+ }
239
+ ```
240
+
241
+ ### Calculation Tool
242
+
243
+ ```xs
244
+ tool "calculate_shipping" {
245
+ description = "Calculate shipping cost for an order"
246
+ input {
247
+ decimal weight description="Total weight in kg"
248
+ text destination description="Destination country code"
249
+ text? method description="Shipping method" default="standard"
250
+ }
251
+ stack {
252
+ // Get shipping rates
253
+ db.get shipping_rate {
254
+ field_name = "country_code"
255
+ field_value = $input.destination
256
+ } as $rate
257
+
258
+ var $base_cost { value = $rate.base_cost }
259
+ var $per_kg { value = $rate.per_kg }
260
+
261
+ var $shipping_cost {
262
+ value = $base_cost + ($input.weight * $per_kg)
263
+ }
264
+
265
+ conditional {
266
+ if ($input.method == "express") {
267
+ var.update $shipping_cost {
268
+ value = $shipping_cost * 1.5
269
+ }
270
+ }
271
+ }
272
+ }
273
+ response = {
274
+ cost: $shipping_cost|round:2,
275
+ currency: "USD",
276
+ method: $input.method,
277
+ estimated_days: $input.method == "express" ? 3 : 7
278
+ }
279
+ }
280
+ ```
281
+
282
+ ### External API Tool
283
+
284
+ ```xs
285
+ tool "get_exchange_rate" {
286
+ description = "Get current exchange rate between currencies"
287
+ input {
288
+ text from description="Source currency code (e.g., USD)"
289
+ text to description="Target currency code (e.g., EUR)"
290
+ }
291
+ stack {
292
+ api.request {
293
+ url = "https://api.exchangerate.com/latest"
294
+ params = {
295
+ base: $input.from
296
+ }
297
+ headers = {
298
+ "Authorization": "Bearer " ~ $env.EXCHANGE_API_KEY
299
+ }
300
+ } as $rates
301
+ }
302
+ response = {
303
+ from: $input.from,
304
+ to: $input.to,
305
+ rate: $rates.rates|get:$input.to,
306
+ timestamp: now|format_timestamp:"Y-m-d H:i:s":"UTC"
307
+ }
308
+ }
309
+ ```
310
+
311
+ ---
312
+
313
+ ## Tool Calling
314
+
315
+ ### From Agent
316
+
317
+ Tools are automatically called by agents when needed. The agent decides when to use a tool based on its description and the user's request.
318
+
319
+ ### Direct Call
320
+
321
+ ```xs
322
+ tool.call {
323
+ name = "search_products"
324
+ input = {
325
+ query: "laptop",
326
+ limit: 5
327
+ }
328
+ } as $products
329
+ ```
330
+
331
+ ---
332
+
333
+ ## Error Handling
334
+
335
+ ```xs
336
+ tool "risky_operation" {
337
+ description = "Perform an operation that might fail"
338
+ input {
339
+ text data description="Data to process"
340
+ }
341
+ stack {
342
+ try_catch {
343
+ try {
344
+ function.run "process_data" {
345
+ input = {data: $input.data}
346
+ } as $result
347
+ }
348
+ catch {
349
+ return {
350
+ value = {
351
+ success: false,
352
+ error: $error.message
353
+ }
354
+ }
355
+ }
356
+ }
357
+ }
358
+ response = {
359
+ success: true,
360
+ result: $result
361
+ }
362
+ }
363
+ ```
364
+
365
+ ---
366
+
367
+ ## Tool Documentation
368
+
369
+ Well-documented tools help AI agents use them correctly:
370
+
371
+ ```xs
372
+ tool "update_inventory" {
373
+ description = """
374
+ Update product inventory levels.
375
+
376
+ Use this tool when:
377
+ - A sale is made (decrease stock)
378
+ - Inventory is restocked (increase stock)
379
+ - Stock needs adjustment
380
+
381
+ Returns the updated inventory count.
382
+ """
383
+ input {
384
+ int product_id description="The ID of the product to update"
385
+ int adjustment description="Amount to adjust (positive to add, negative to subtract)"
386
+ text? reason description="Reason for adjustment (optional but recommended)"
387
+ }
388
+ stack {
389
+ db.patch product {
390
+ field_name = "id"
391
+ field_value = $input.product_id
392
+ data = {
393
+ stock: $db.product.stock + $input.adjustment,
394
+ updated_at: now
395
+ }
396
+ } as $product
397
+
398
+ // Log the adjustment
399
+ db.add inventory_log {
400
+ data = {
401
+ product_id: $input.product_id,
402
+ adjustment: $input.adjustment,
403
+ reason: $input.reason,
404
+ new_stock: $product.stock,
405
+ created_at: now
406
+ }
407
+ }
408
+ }
409
+ response = {
410
+ product_id: $product.id,
411
+ new_stock: $product.stock,
412
+ adjustment_logged: true
413
+ }
414
+ }
415
+ ```
416
+
417
+ ---
418
+
419
+ ## Best Practices
420
+
421
+ ### Clear Descriptions
422
+
423
+ ```xs
424
+ // Good: Specific and actionable
425
+ description = "Search for products by name, category, or price range. Returns up to 20 matching products with name, price, and availability."
426
+
427
+ // Bad: Vague
428
+ description = "Search products"
429
+ ```
430
+
431
+ ### Parameter Documentation
432
+
433
+ ```xs
434
+ input {
435
+ text query description="Full or partial product name to search for"
436
+ decimal? min_price description="Minimum price filter in USD"
437
+ decimal? max_price description="Maximum price filter in USD"
438
+ bool? in_stock_only description="If true, only return products with stock > 0" default=false
439
+ }
440
+ ```
441
+
442
+ ### Return Useful Data
443
+
444
+ ```xs
445
+ // Return data the agent can work with
446
+ response = {
447
+ found: $results|count,
448
+ products: $results|map:{
449
+ id: $$.id,
450
+ name: $$.name,
451
+ price: $$.price,
452
+ available: $$.stock > 0
453
+ },
454
+ has_more: $total > $limit
455
+ }
456
+ ```
457
+
458
+ ### Handle Edge Cases
459
+
460
+ ```xs
461
+ tool "get_user_profile" {
462
+ input {
463
+ int user_id
464
+ }
465
+ stack {
466
+ db.get user {
467
+ field_name = "id"
468
+ field_value = $input.user_id
469
+ } as $user
470
+
471
+ // Handle not found
472
+ conditional {
473
+ if ($user == null) {
474
+ return {
475
+ value = {
476
+ error: "User not found",
477
+ user_id: $input.user_id
478
+ }
479
+ }
480
+ }
481
+ }
482
+ }
483
+ response = $user
484
+ }
485
+ ```