@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,485 +0,0 @@
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
- ```