@xano/developer-mcp 1.0.0 → 1.0.2

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 (46) hide show
  1. package/README.md +96 -31
  2. package/dist/index.js +335 -222
  3. package/dist/templates/init-workspace.d.ts +10 -0
  4. package/dist/templates/init-workspace.js +292 -0
  5. package/dist/templates/xanoscript-index.d.ts +9 -0
  6. package/dist/templates/xanoscript-index.js +61 -0
  7. package/package.json +4 -2
  8. package/xanoscript_docs/README.md +107 -1
  9. package/xanoscript_docs/agents.md +329 -0
  10. package/xanoscript_docs/apis.md +343 -0
  11. package/xanoscript_docs/database.md +417 -0
  12. package/xanoscript_docs/ephemeral.md +333 -0
  13. package/xanoscript_docs/frontend.md +291 -0
  14. package/xanoscript_docs/functions.md +232 -2035
  15. package/xanoscript_docs/integrations.md +439 -0
  16. package/xanoscript_docs/mcp-servers.md +190 -0
  17. package/xanoscript_docs/plan.md +192 -0
  18. package/xanoscript_docs/syntax.md +314 -0
  19. package/xanoscript_docs/tables.md +270 -0
  20. package/xanoscript_docs/tasks.md +254 -0
  21. package/xanoscript_docs/testing.md +335 -0
  22. package/xanoscript_docs/tools.md +305 -0
  23. package/xanoscript_docs/types.md +297 -0
  24. package/xanoscript_docs/version.json +2 -1
  25. package/xanoscript_docs/api_query_examples.md +0 -1255
  26. package/xanoscript_docs/api_query_guideline.md +0 -129
  27. package/xanoscript_docs/build_from_lovable.md +0 -715
  28. package/xanoscript_docs/db_query_guideline.md +0 -427
  29. package/xanoscript_docs/ephemeral_environment_guideline.md +0 -529
  30. package/xanoscript_docs/expression_guideline.md +0 -1086
  31. package/xanoscript_docs/frontend_guideline.md +0 -67
  32. package/xanoscript_docs/function_examples.md +0 -1406
  33. package/xanoscript_docs/function_guideline.md +0 -130
  34. package/xanoscript_docs/input_guideline.md +0 -227
  35. package/xanoscript_docs/mcp_server_examples.md +0 -36
  36. package/xanoscript_docs/mcp_server_guideline.md +0 -69
  37. package/xanoscript_docs/query_filter.md +0 -489
  38. package/xanoscript_docs/table_examples.md +0 -586
  39. package/xanoscript_docs/table_guideline.md +0 -137
  40. package/xanoscript_docs/task_examples.md +0 -511
  41. package/xanoscript_docs/task_guideline.md +0 -103
  42. package/xanoscript_docs/tips_and_tricks.md +0 -144
  43. package/xanoscript_docs/tool_examples.md +0 -69
  44. package/xanoscript_docs/tool_guideline.md +0 -139
  45. package/xanoscript_docs/unit_testing_guideline.md +0 -328
  46. package/xanoscript_docs/workspace.md +0 -17
@@ -1,129 +0,0 @@
1
- ---
2
- applyTo: "apis/**/*.xs"
3
- ---
4
-
5
- # How to Define API Queries in XanoScript
6
-
7
- An **API query** in XanoScript defines an endpoint for handling HTTP requests (GET, POST, etc.). Queries are created in the `apis/<api-group>/` folder, where `<api-group>` is the name of your API group. Queries cannot have subfolders; each query belongs to its API group.
8
-
9
- ## Query Structure
10
-
11
- A query file consists of:
12
-
13
- - The query name and HTTP verb (e.g., `products verb=GET`)
14
- - An optional `description` field
15
- - An `input` block for request parameters
16
- - A `stack` block for processing logic
17
- - A `response` block for returned data
18
-
19
- ## Authentication
20
-
21
- By default a query will be public. To require authentication, add an `auth` field with the name of the table to use for authentication (this would usually be a `user` table). When `auth` is set, the variable `$auth.id` will contain the authenticated user's ID. Xano offers built-in JWT authentication endpoint to signup, login and retrieve your user information. Endpoints requiring authentication expect the JWT token to be sent in the `Authorization` header as a Bearer token.
22
-
23
- ## Example Query
24
-
25
- The following script would be stored in `apis/product/products.xs`, which means its API group would be `product`. It requires authentication and returns a list of products filtered by category.
26
-
27
- ```xs
28
- query "products" verb=GET {
29
- description = "Returns a list of products filtered by category, requires user authentication"
30
- auth = "user"
31
-
32
- input {
33
- text category filters=trim {
34
- description = "Product category to filter by"
35
- }
36
- }
37
- stack {
38
- var $category_filter {
39
- value = $input.category
40
- }
41
- conditional {
42
- if (($category_filter|strlen) > 0) {
43
- db.query "product" {
44
- where = ($db.product.category|to_lower) == ($category_filter|to_lower)
45
- } as $filtered_products
46
- }
47
- else {
48
- db.query "product" {
49
- } as $filtered_products
50
- }
51
- }
52
- }
53
- response = $filtered_products
54
- }
55
- ```
56
-
57
- ## Input Block
58
-
59
- Defines the parameters accepted by the API endpoint. You can specify:
60
-
61
- - Data types (`int`, `text`, `decimal`, etc.)
62
- - Optional fields (add `?`)
63
- - Filters (e.g., `trim`, `lower`)
64
- - Metadata (`description`, `sensitive`)
65
-
66
- **Example:**
67
-
68
- ```xs
69
- input {
70
- int page?=1 {
71
- description = "Page number for pagination"
72
- }
73
- int per_page?=10 {
74
- description = "Items per page"
75
- }
76
- }
77
- ```
78
-
79
- ## Stack Block
80
-
81
- Contains the logic for processing the request, such as:
82
-
83
- - Variable declarations (`var`)
84
- - Control flow (`conditional`, `for`, `foreach`)
85
- - Database operations (`db.query`, `db.add`)
86
- - Function calls (`function.run`)
87
- - Logging (`debug.log`)
88
- - Error handling (`throw`, `try_catch`)
89
-
90
- ## Response Content Type
91
-
92
- By default the response type is "application/json", to return a web page set the response type to "text/html" using the `util.set_header` statement:
93
-
94
- ```xs
95
- util.set_header {
96
- value = "Content-Type: text/html; charset=utf-8"
97
- duplicates = "replace"
98
- }
99
- ```
100
-
101
- ## Response Block
102
-
103
- Specifies the data returned by the API. The value can be a variable, object, or expression.
104
-
105
- **Example:**
106
-
107
- ```xs
108
- response = $filtered_products
109
- ```
110
-
111
- ## Best Practices
112
-
113
- - Use `description` for documentation.
114
- - Validate inputs with filters and `precondition` blocks.
115
- - Place all logic inside the `stack` block.
116
- - Always define a `response` block for output.
117
- - Use pagination and sorting for large datasets.
118
-
119
- ## Summary
120
-
121
- - Always place a query in under an API group folder.
122
- - To create a new API group, just create a folder under `apis/`.
123
- - Place queries in the `apis/<api-group>/` folder.
124
- - Use `input` for request parameters.
125
- - Use `stack` for processing logic.
126
- - Use `response` for returned data.
127
- - Document your query with `description` fields.
128
-
129
- For more examples, see the documentation or sample queries in your