@xano/developer-mcp 1.0.2 → 1.0.4
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.
- package/package.json +1 -1
- package/xanoscript_docs/apis.md +54 -3
package/package.json
CHANGED
package/xanoscript_docs/apis.md
CHANGED
|
@@ -10,6 +10,7 @@ HTTP endpoint definitions in XanoScript.
|
|
|
10
10
|
|
|
11
11
|
```xs
|
|
12
12
|
query "<path>" verb=<METHOD> {
|
|
13
|
+
api_group = "<GroupName>" # Required: API group for organization
|
|
13
14
|
description = "What this endpoint does"
|
|
14
15
|
auth = "<table>" # Optional: require authentication
|
|
15
16
|
input { ... }
|
|
@@ -21,23 +22,65 @@ query "<path>" verb=<METHOD> {
|
|
|
21
22
|
### HTTP Methods
|
|
22
23
|
`GET`, `POST`, `PUT`, `PATCH`, `DELETE`
|
|
23
24
|
|
|
25
|
+
### API Groups (Required)
|
|
26
|
+
|
|
27
|
+
Every API endpoint **must** belong to an API group. API groups organize related endpoints together.
|
|
28
|
+
|
|
29
|
+
**Two requirements for API groups:**
|
|
30
|
+
1. Each `query` definition **must** include an `api_group` property specifying which group it belongs to
|
|
31
|
+
2. API groups are organized as folders within `apis/`, each with an `api_group.xs` file
|
|
32
|
+
|
|
33
|
+
- API groups appear as top-level folders under `apis/`
|
|
34
|
+
- Each group **must** have an `api_group.xs` file that defines the group
|
|
35
|
+
- The group contains `.xs` files defining individual endpoints
|
|
36
|
+
- The group name becomes part of the endpoint URL path
|
|
37
|
+
- You cannot create endpoints directly in the `apis/` root folder
|
|
38
|
+
|
|
39
|
+
#### Defining an API Group
|
|
40
|
+
|
|
41
|
+
Create an `api_group.xs` file in the group folder:
|
|
42
|
+
|
|
43
|
+
```xs
|
|
44
|
+
api_group "users" {
|
|
45
|
+
description = "User management endpoints"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### API Group Properties
|
|
50
|
+
|
|
51
|
+
| Property | Description |
|
|
52
|
+
|----------|-------------|
|
|
53
|
+
| `description` | What this API group contains |
|
|
54
|
+
| `canonical` | Optional: custom URL path (overrides folder name) |
|
|
55
|
+
|
|
56
|
+
```xs
|
|
57
|
+
api_group "events" {
|
|
58
|
+
canonical = "events-api" # URL will use /events-api instead of /events
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
24
62
|
### File Structure
|
|
25
63
|
```
|
|
26
64
|
apis/
|
|
27
|
-
├── users/ # API group
|
|
65
|
+
├── users/ # API group folder
|
|
66
|
+
│ ├── api_group.xs # Required: defines the group
|
|
28
67
|
│ ├── list.xs # GET /users
|
|
29
68
|
│ ├── create.xs # POST /users
|
|
30
69
|
│ └── {id}.xs # GET/PATCH/DELETE /users/{id}
|
|
31
|
-
└── products/
|
|
32
|
-
|
|
70
|
+
└── products/ # Another API group
|
|
71
|
+
├── api_group.xs # Required: defines the group
|
|
72
|
+
└── search.xs # GET /products/search
|
|
33
73
|
```
|
|
34
74
|
|
|
75
|
+
> **Note:** Files placed directly in `apis/` without a group folder are invalid. Each API group folder must contain an `api_group.xs` file.
|
|
76
|
+
|
|
35
77
|
---
|
|
36
78
|
|
|
37
79
|
## Basic Structure
|
|
38
80
|
|
|
39
81
|
```xs
|
|
40
82
|
query "products" verb=GET {
|
|
83
|
+
api_group = "Products"
|
|
41
84
|
description = "List all products"
|
|
42
85
|
input {
|
|
43
86
|
int page?=1 filters=min:1
|
|
@@ -59,6 +102,7 @@ query "products" verb=GET {
|
|
|
59
102
|
### Public Endpoint (default)
|
|
60
103
|
```xs
|
|
61
104
|
query "status" verb=GET {
|
|
105
|
+
api_group = "System"
|
|
62
106
|
stack { }
|
|
63
107
|
response = { status: "ok" }
|
|
64
108
|
}
|
|
@@ -67,6 +111,7 @@ query "status" verb=GET {
|
|
|
67
111
|
### Authenticated Endpoint
|
|
68
112
|
```xs
|
|
69
113
|
query "profile" verb=GET {
|
|
114
|
+
api_group = "Users"
|
|
70
115
|
auth = "user" # Requires valid JWT
|
|
71
116
|
stack {
|
|
72
117
|
db.get "user" {
|
|
@@ -91,6 +136,7 @@ Use `{param}` in the path:
|
|
|
91
136
|
|
|
92
137
|
```xs
|
|
93
138
|
query "users/{user_id}" verb=GET {
|
|
139
|
+
api_group = "Users"
|
|
94
140
|
auth = "user"
|
|
95
141
|
input {
|
|
96
142
|
int user_id { table = "user" }
|
|
@@ -112,6 +158,7 @@ query "users/{user_id}" verb=GET {
|
|
|
112
158
|
### List (GET)
|
|
113
159
|
```xs
|
|
114
160
|
query "products" verb=GET {
|
|
161
|
+
api_group = "Products"
|
|
115
162
|
input {
|
|
116
163
|
text category? filters=trim|lower
|
|
117
164
|
int page?=1
|
|
@@ -131,6 +178,7 @@ query "products" verb=GET {
|
|
|
131
178
|
### Create (POST)
|
|
132
179
|
```xs
|
|
133
180
|
query "products" verb=POST {
|
|
181
|
+
api_group = "Products"
|
|
134
182
|
auth = "user"
|
|
135
183
|
input {
|
|
136
184
|
text name filters=trim
|
|
@@ -156,6 +204,7 @@ query "products" verb=POST {
|
|
|
156
204
|
### Read (GET with ID)
|
|
157
205
|
```xs
|
|
158
206
|
query "products/{product_id}" verb=GET {
|
|
207
|
+
api_group = "Products"
|
|
159
208
|
input {
|
|
160
209
|
int product_id { table = "product" }
|
|
161
210
|
}
|
|
@@ -177,6 +226,7 @@ query "products/{product_id}" verb=GET {
|
|
|
177
226
|
### Update (PATCH)
|
|
178
227
|
```xs
|
|
179
228
|
query "products/{product_id}" verb=PATCH {
|
|
229
|
+
api_group = "Products"
|
|
180
230
|
auth = "user"
|
|
181
231
|
input {
|
|
182
232
|
int product_id { table = "product" }
|
|
@@ -211,6 +261,7 @@ query "products/{product_id}" verb=PATCH {
|
|
|
211
261
|
### Delete (DELETE)
|
|
212
262
|
```xs
|
|
213
263
|
query "products/{product_id}" verb=DELETE {
|
|
264
|
+
api_group = "Products"
|
|
214
265
|
auth = "user"
|
|
215
266
|
input {
|
|
216
267
|
int product_id { table = "product" }
|