@xano/developer-mcp 1.0.11 → 1.0.13
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/README.md +78 -60
- package/dist/api_docs/format.d.ts +5 -0
- package/dist/api_docs/format.js +168 -0
- package/dist/api_docs/index.d.ts +52 -0
- package/dist/api_docs/index.js +111 -0
- package/dist/api_docs/topics/agent.d.ts +2 -0
- package/dist/api_docs/topics/agent.js +142 -0
- package/dist/api_docs/topics/api.d.ts +2 -0
- package/dist/api_docs/topics/api.js +176 -0
- package/dist/api_docs/topics/apigroup.d.ts +2 -0
- package/dist/api_docs/topics/apigroup.js +124 -0
- package/dist/api_docs/topics/authentication.d.ts +2 -0
- package/dist/api_docs/topics/authentication.js +61 -0
- package/dist/api_docs/topics/branch.d.ts +2 -0
- package/dist/api_docs/topics/branch.js +73 -0
- package/dist/api_docs/topics/file.d.ts +2 -0
- package/dist/api_docs/topics/file.js +70 -0
- package/dist/api_docs/topics/function.d.ts +2 -0
- package/dist/api_docs/topics/function.js +164 -0
- package/dist/api_docs/topics/history.d.ts +2 -0
- package/dist/api_docs/topics/history.js +149 -0
- package/dist/api_docs/topics/mcp_server.d.ts +2 -0
- package/dist/api_docs/topics/mcp_server.js +139 -0
- package/dist/api_docs/topics/middleware.d.ts +2 -0
- package/dist/api_docs/topics/middleware.js +156 -0
- package/dist/api_docs/topics/realtime.d.ts +2 -0
- package/dist/api_docs/topics/realtime.js +112 -0
- package/dist/api_docs/topics/start.d.ts +2 -0
- package/dist/api_docs/topics/start.js +107 -0
- package/dist/api_docs/topics/table.d.ts +2 -0
- package/dist/api_docs/topics/table.js +195 -0
- package/dist/api_docs/topics/task.d.ts +2 -0
- package/dist/api_docs/topics/task.js +165 -0
- package/dist/api_docs/topics/tool.d.ts +2 -0
- package/dist/api_docs/topics/tool.js +150 -0
- package/dist/api_docs/topics/workflows.d.ts +2 -0
- package/dist/api_docs/topics/workflows.js +131 -0
- package/dist/api_docs/topics/workspace.d.ts +2 -0
- package/dist/api_docs/topics/workspace.js +153 -0
- package/dist/api_docs/types.d.ts +79 -0
- package/dist/api_docs/types.js +4 -0
- package/dist/index.js +46 -92
- package/dist/templates/init-workspace.js +2 -16
- package/package.json +4 -7
- package/api_docs/addon.md +0 -193
- package/api_docs/agent.md +0 -154
- package/api_docs/api_group.md +0 -236
- package/api_docs/authentication.md +0 -68
- package/api_docs/file.md +0 -190
- package/api_docs/function.md +0 -217
- package/api_docs/history.md +0 -263
- package/api_docs/index.md +0 -104
- package/api_docs/mcp_server.md +0 -139
- package/api_docs/middleware.md +0 -205
- package/api_docs/realtime.md +0 -153
- package/api_docs/table.md +0 -151
- package/api_docs/task.md +0 -191
- package/api_docs/tool.md +0 -216
- package/api_docs/triggers.md +0 -344
- package/api_docs/workspace.md +0 -246
- /package/{xanoscript_docs → dist/xanoscript_docs}/README.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/addons.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/agents.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/apis.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/database.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/debugging.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/ephemeral.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/frontend.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/functions.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/integrations.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/mcp-servers.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/performance.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/realtime.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/schema.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/security.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/streaming.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/syntax.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/tables.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/tasks.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/testing.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/tools.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/triggers.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/types.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/version.json +0 -0
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { dirname, join } from "path";
|
|
|
8
8
|
import { minimatch } from "minimatch";
|
|
9
9
|
import { xanoscriptParser } from "@xano/xanoscript-language-server/parser/parser.js";
|
|
10
10
|
import { getSchemeFromContent } from "@xano/xanoscript-language-server/utils.js";
|
|
11
|
+
import { apiDocsToolDefinition, handleApiDocs } from "./api_docs/index.js";
|
|
11
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
13
|
const __dirname = dirname(__filename);
|
|
13
14
|
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
@@ -134,48 +135,12 @@ const XANOSCRIPT_DOCS_V2 = {
|
|
|
134
135
|
},
|
|
135
136
|
};
|
|
136
137
|
// =============================================================================
|
|
137
|
-
// API Documentation Configuration
|
|
138
|
-
// =============================================================================
|
|
139
|
-
const DOCS_MAP = {
|
|
140
|
-
workspace: "workspace.md",
|
|
141
|
-
table: "table.md",
|
|
142
|
-
api_group: "api_group.md",
|
|
143
|
-
function: "function.md",
|
|
144
|
-
task: "task.md",
|
|
145
|
-
middleware: "middleware.md",
|
|
146
|
-
addon: "addon.md",
|
|
147
|
-
agent: "agent.md",
|
|
148
|
-
tool: "tool.md",
|
|
149
|
-
mcp_server: "mcp_server.md",
|
|
150
|
-
realtime: "realtime.md",
|
|
151
|
-
triggers: "triggers.md",
|
|
152
|
-
file: "file.md",
|
|
153
|
-
history: "history.md",
|
|
154
|
-
authentication: "authentication.md",
|
|
155
|
-
};
|
|
156
|
-
// =============================================================================
|
|
157
138
|
// Path Resolution
|
|
158
139
|
// =============================================================================
|
|
159
|
-
function getDocsPath() {
|
|
160
|
-
const possiblePaths = [
|
|
161
|
-
join(__dirname, "..", "api_docs"),
|
|
162
|
-
join(__dirname, "..", "..", "api_docs"),
|
|
163
|
-
];
|
|
164
|
-
for (const p of possiblePaths) {
|
|
165
|
-
try {
|
|
166
|
-
readFileSync(join(p, "index.md"));
|
|
167
|
-
return p;
|
|
168
|
-
}
|
|
169
|
-
catch {
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return join(__dirname, "..", "api_docs");
|
|
174
|
-
}
|
|
175
140
|
function getXanoscriptDocsPath() {
|
|
176
141
|
const possiblePaths = [
|
|
177
|
-
join(__dirname, "
|
|
178
|
-
join(__dirname, "..", "
|
|
142
|
+
join(__dirname, "xanoscript_docs"), // dist/xanoscript_docs (production)
|
|
143
|
+
join(__dirname, "..", "src", "xanoscript_docs"), // src/xanoscript_docs (dev before build)
|
|
179
144
|
];
|
|
180
145
|
for (const p of possiblePaths) {
|
|
181
146
|
try {
|
|
@@ -186,9 +151,8 @@ function getXanoscriptDocsPath() {
|
|
|
186
151
|
continue;
|
|
187
152
|
}
|
|
188
153
|
}
|
|
189
|
-
return join(__dirname, "
|
|
154
|
+
return join(__dirname, "xanoscript_docs");
|
|
190
155
|
}
|
|
191
|
-
const DOCS_PATH = getDocsPath();
|
|
192
156
|
const XANOSCRIPT_DOCS_PATH = getXanoscriptDocsPath();
|
|
193
157
|
// =============================================================================
|
|
194
158
|
// Documentation Helpers
|
|
@@ -202,31 +166,6 @@ function getXanoscriptDocsVersion() {
|
|
|
202
166
|
return "unknown";
|
|
203
167
|
}
|
|
204
168
|
}
|
|
205
|
-
function readDocumentation(object) {
|
|
206
|
-
try {
|
|
207
|
-
if (!object) {
|
|
208
|
-
return readFileSync(join(DOCS_PATH, "index.md"), "utf-8");
|
|
209
|
-
}
|
|
210
|
-
const normalizedObject = object.toLowerCase().trim();
|
|
211
|
-
if (normalizedObject in DOCS_MAP) {
|
|
212
|
-
const filePath = join(DOCS_PATH, DOCS_MAP[normalizedObject]);
|
|
213
|
-
return readFileSync(filePath, "utf-8");
|
|
214
|
-
}
|
|
215
|
-
const matchingKey = Object.keys(DOCS_MAP).find((key) => key.includes(normalizedObject) || normalizedObject.includes(key));
|
|
216
|
-
if (matchingKey) {
|
|
217
|
-
const filePath = join(DOCS_PATH, DOCS_MAP[matchingKey]);
|
|
218
|
-
return readFileSync(filePath, "utf-8");
|
|
219
|
-
}
|
|
220
|
-
const availableObjects = Object.keys(DOCS_MAP).join(", ");
|
|
221
|
-
return `Error: Unknown object "${object}". Available objects: ${availableObjects}
|
|
222
|
-
|
|
223
|
-
Use api_docs() without parameters to see the full documentation index.`;
|
|
224
|
-
}
|
|
225
|
-
catch (error) {
|
|
226
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
227
|
-
return `Error reading documentation: ${errorMessage}`;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
169
|
// =============================================================================
|
|
231
170
|
// XanoScript Documentation v2 Functions
|
|
232
171
|
// =============================================================================
|
|
@@ -372,20 +311,6 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
|
372
311
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
373
312
|
return {
|
|
374
313
|
tools: [
|
|
375
|
-
{
|
|
376
|
-
name: "api_docs",
|
|
377
|
-
description: "Get Xano Headless API documentation. Returns documentation for interacting with the Xano Headless API using XanoScript. Use without parameters for an overview, or specify an object for detailed documentation.",
|
|
378
|
-
inputSchema: {
|
|
379
|
-
type: "object",
|
|
380
|
-
properties: {
|
|
381
|
-
object: {
|
|
382
|
-
type: "string",
|
|
383
|
-
description: `Optional: The specific API object to get documentation for. Available values: ${Object.keys(DOCS_MAP).join(", ")}`,
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
required: [],
|
|
387
|
-
},
|
|
388
|
-
},
|
|
389
314
|
{
|
|
390
315
|
name: "validate_xanoscript",
|
|
391
316
|
description: "Validate XanoScript code for syntax errors. Returns a list of errors with line/column positions, or confirms the code is valid. The language server auto-detects the object type from the code syntax.",
|
|
@@ -441,23 +366,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
441
366
|
required: [],
|
|
442
367
|
},
|
|
443
368
|
},
|
|
369
|
+
apiDocsToolDefinition,
|
|
444
370
|
],
|
|
445
371
|
};
|
|
446
372
|
});
|
|
447
373
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
448
|
-
if (request.params.name === "api_docs") {
|
|
449
|
-
const args = request.params.arguments;
|
|
450
|
-
const object = args?.object;
|
|
451
|
-
const documentation = readDocumentation(object);
|
|
452
|
-
return {
|
|
453
|
-
content: [
|
|
454
|
-
{
|
|
455
|
-
type: "text",
|
|
456
|
-
text: documentation,
|
|
457
|
-
},
|
|
458
|
-
],
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
374
|
if (request.params.name === "validate_xanoscript") {
|
|
462
375
|
const args = request.params.arguments;
|
|
463
376
|
if (!args?.code) {
|
|
@@ -552,6 +465,47 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
552
465
|
],
|
|
553
466
|
};
|
|
554
467
|
}
|
|
468
|
+
if (request.params.name === "api_docs") {
|
|
469
|
+
const args = request.params.arguments;
|
|
470
|
+
if (!args?.topic) {
|
|
471
|
+
return {
|
|
472
|
+
content: [
|
|
473
|
+
{
|
|
474
|
+
type: "text",
|
|
475
|
+
text: "Error: 'topic' parameter is required. Use api_docs with topic='start' for overview.",
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
isError: true,
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
try {
|
|
482
|
+
const documentation = handleApiDocs({
|
|
483
|
+
topic: args.topic,
|
|
484
|
+
detail_level: args.detail_level,
|
|
485
|
+
include_schemas: args.include_schemas,
|
|
486
|
+
});
|
|
487
|
+
return {
|
|
488
|
+
content: [
|
|
489
|
+
{
|
|
490
|
+
type: "text",
|
|
491
|
+
text: documentation,
|
|
492
|
+
},
|
|
493
|
+
],
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
catch (error) {
|
|
497
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
498
|
+
return {
|
|
499
|
+
content: [
|
|
500
|
+
{
|
|
501
|
+
type: "text",
|
|
502
|
+
text: `Error retrieving API documentation: ${errorMessage}`,
|
|
503
|
+
},
|
|
504
|
+
],
|
|
505
|
+
isError: true,
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
}
|
|
555
509
|
return {
|
|
556
510
|
content: [
|
|
557
511
|
{
|
|
@@ -110,7 +110,7 @@ The \`.xano/registry.json\` file tracks the sync state between local files and t
|
|
|
110
110
|
|
|
111
111
|
## Fetching Objects from the API
|
|
112
112
|
|
|
113
|
-
Use the Headless API to fetch objects.
|
|
113
|
+
Use the Headless API to fetch objects.
|
|
114
114
|
|
|
115
115
|
### List Objects
|
|
116
116
|
|
|
@@ -175,7 +175,7 @@ apis/
|
|
|
175
175
|
└── GET_me.xs # Another endpoint
|
|
176
176
|
\`\`\`
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
API groups contain endpoints that share common configuration.
|
|
179
179
|
|
|
180
180
|
## Pull Workflow
|
|
181
181
|
|
|
@@ -255,20 +255,6 @@ const response = await fetch(
|
|
|
255
255
|
);
|
|
256
256
|
\`\`\`
|
|
257
257
|
|
|
258
|
-
## API Documentation References
|
|
259
|
-
|
|
260
|
-
For detailed API documentation on each object type, use:
|
|
261
|
-
|
|
262
|
-
- \`api_docs()\` - Overview of all endpoints
|
|
263
|
-
- \`api_docs({ object: "workspace" })\` - Workspace management
|
|
264
|
-
- \`api_docs({ object: "function" })\` - Functions API
|
|
265
|
-
- \`api_docs({ object: "table" })\` - Tables API
|
|
266
|
-
- \`api_docs({ object: "task" })\` - Tasks API
|
|
267
|
-
- \`api_docs({ object: "api_group" })\` - API groups and endpoints
|
|
268
|
-
- \`api_docs({ object: "agent" })\` - AI agents
|
|
269
|
-
- \`api_docs({ object: "tool" })\` - AI tools
|
|
270
|
-
- \`api_docs({ object: "authentication" })\` - Auth and user info
|
|
271
|
-
|
|
272
258
|
## XanoScript Documentation References
|
|
273
259
|
|
|
274
260
|
For writing XanoScript code, use:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xano/developer-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "MCP server for Xano Headless API documentation and XanoScript code validation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,16 +8,13 @@
|
|
|
8
8
|
"xano-developer-mcp": "./dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
"api_docs",
|
|
13
|
-
"xanoscript_docs"
|
|
11
|
+
"dist"
|
|
14
12
|
],
|
|
15
13
|
"scripts": {
|
|
16
|
-
"build": "tsc",
|
|
14
|
+
"build": "tsc && cp -r src/xanoscript_docs dist/",
|
|
17
15
|
"start": "node dist/index.js",
|
|
18
16
|
"dev": "tsc && node dist/index.js",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
20
|
-
"sync-docs": "npx ts-node scripts/sync-xanoscript-docs.ts"
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
21
18
|
},
|
|
22
19
|
"keywords": [
|
|
23
20
|
"xano",
|
package/api_docs/addon.md
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
# Addon API
|
|
2
|
-
|
|
3
|
-
Addons are reusable query components that can be attached to API responses to transform or enrich data. They're commonly used for joining related data or formatting output.
|
|
4
|
-
|
|
5
|
-
## Endpoints Overview
|
|
6
|
-
|
|
7
|
-
| Method | Endpoint | Description |
|
|
8
|
-
|--------|----------|-------------|
|
|
9
|
-
| GET | `/workspace/{workspace_id}/addon` | List addons |
|
|
10
|
-
| GET | `/workspace/{workspace_id}/addon/{addon_id}` | Get addon |
|
|
11
|
-
| POST | `/workspace/{workspace_id}/addon` | Create addon |
|
|
12
|
-
| PUT | `/workspace/{workspace_id}/addon/{addon_id}` | Update addon |
|
|
13
|
-
| DELETE | `/workspace/{workspace_id}/addon/{addon_id}` | Delete addon |
|
|
14
|
-
| PUT | `/workspace/{workspace_id}/addon/{addon_id}/security` | Update security |
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## List Addons
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
GET /workspace/{workspace_id}/addon
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Query Parameters:**
|
|
25
|
-
| Parameter | Type | Default | Description |
|
|
26
|
-
|-----------|------|---------|-------------|
|
|
27
|
-
| `branch` | text | "" | Branch label |
|
|
28
|
-
| `page` | int | 1 | Page number |
|
|
29
|
-
| `per_page` | int | 50 | Items per page (1-10000) |
|
|
30
|
-
| `search` | text | "" | Search filter |
|
|
31
|
-
| `sort` | enum | "created_at" | Sort field |
|
|
32
|
-
| `order` | enum | "desc" | Sort order |
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Get Addon
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
GET /workspace/{workspace_id}/addon/{addon_id}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Returns addon definition including XanoScript.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Create Addon
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
POST /workspace/{workspace_id}/addon
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Content-Type:** `text/x-xanoscript`
|
|
53
|
-
|
|
54
|
-
**Query Parameters:**
|
|
55
|
-
- `branch` (text): Target branch label
|
|
56
|
-
|
|
57
|
-
### XanoScript Addon Syntax
|
|
58
|
-
|
|
59
|
-
```xanoscript
|
|
60
|
-
addon foo {
|
|
61
|
-
input {
|
|
62
|
-
int foo_id {
|
|
63
|
-
dbtable = "foo"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
stack {
|
|
68
|
-
db.query foo {
|
|
69
|
-
where = $db.foo.id == $input.foo_id
|
|
70
|
-
return = {type: "single"}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Input Section
|
|
77
|
-
|
|
78
|
-
Define input parameters that link to database fields:
|
|
79
|
-
|
|
80
|
-
```xanoscript
|
|
81
|
-
input {
|
|
82
|
-
int user_id {
|
|
83
|
-
dbtable = "user" // Links to user table
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
The `dbtable` property specifies which table field to join on.
|
|
89
|
-
|
|
90
|
-
### Stack Section
|
|
91
|
-
|
|
92
|
-
Query logic to fetch related data:
|
|
93
|
-
|
|
94
|
-
```xanoscript
|
|
95
|
-
stack {
|
|
96
|
-
db.query user {
|
|
97
|
-
where = $db.user.id == $input.user_id
|
|
98
|
-
return = {type: "single"}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Use Cases
|
|
104
|
-
|
|
105
|
-
- Join related data (e.g., fetch author for a post)
|
|
106
|
-
- Computed fields
|
|
107
|
-
- Data aggregation
|
|
108
|
-
- Response transformation
|
|
109
|
-
|
|
110
|
-
### Example: Author Addon
|
|
111
|
-
|
|
112
|
-
```xanoscript
|
|
113
|
-
addon author_info {
|
|
114
|
-
input {
|
|
115
|
-
int author_id {
|
|
116
|
-
dbtable = "user"
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
stack {
|
|
121
|
-
db.query user {
|
|
122
|
-
select = ["id", "name", "avatar"]
|
|
123
|
-
where = $db.user.id == $input.author_id
|
|
124
|
-
return = {type: "single"}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Example: Order Summary Addon
|
|
131
|
-
|
|
132
|
-
```xanoscript
|
|
133
|
-
addon order_summary {
|
|
134
|
-
input {
|
|
135
|
-
int order_id {
|
|
136
|
-
dbtable = "order"
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
stack {
|
|
141
|
-
// Get order items
|
|
142
|
-
db.query order_item {
|
|
143
|
-
where = $db.order_item.order_id == $input.order_id
|
|
144
|
-
return = {type: "list"}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Calculate totals
|
|
148
|
-
var $item_count {
|
|
149
|
-
value = count($order_item)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
var $total {
|
|
153
|
-
value = sum($order_item, "price")
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## Update Addon
|
|
162
|
-
|
|
163
|
-
```
|
|
164
|
-
PUT /workspace/{workspace_id}/addon/{addon_id}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**Query Parameters:**
|
|
168
|
-
- `publish` (bool, default: true): Publish changes immediately
|
|
169
|
-
|
|
170
|
-
**Content-Type:** `text/x-xanoscript`
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## Delete Addon
|
|
175
|
-
|
|
176
|
-
```
|
|
177
|
-
DELETE /workspace/{workspace_id}/addon/{addon_id}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
**Warning:** This action cannot be undone.
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## Update Addon Security
|
|
185
|
-
|
|
186
|
-
```
|
|
187
|
-
PUT /workspace/{workspace_id}/addon/{addon_id}/security
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
**Parameters:**
|
|
191
|
-
| Parameter | Type | Required | Description |
|
|
192
|
-
|-----------|------|----------|-------------|
|
|
193
|
-
| `guid` | text | Yes | New security GUID |
|
package/api_docs/agent.md
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# Agent API
|
|
2
|
-
|
|
3
|
-
Agents are AI-powered assistants that can use tools to accomplish tasks. They are configured with an LLM provider, system prompt, and available tools.
|
|
4
|
-
|
|
5
|
-
## Endpoints Overview
|
|
6
|
-
|
|
7
|
-
| Method | Endpoint | Description |
|
|
8
|
-
|--------|----------|-------------|
|
|
9
|
-
| GET | `/workspace/{workspace_id}/agent` | List agents |
|
|
10
|
-
| GET | `/workspace/{workspace_id}/agent/{agent_id}` | Get agent |
|
|
11
|
-
| POST | `/workspace/{workspace_id}/agent` | Create agent |
|
|
12
|
-
| PUT | `/workspace/{workspace_id}/agent/{agent_id}` | Update agent |
|
|
13
|
-
| DELETE | `/workspace/{workspace_id}/agent/{agent_id}` | Delete agent |
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## List Agents
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
GET /workspace/{workspace_id}/agent
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Query Parameters:**
|
|
24
|
-
| Parameter | Type | Default | Description |
|
|
25
|
-
|-----------|------|---------|-------------|
|
|
26
|
-
| `branch` | text | "" | Branch label |
|
|
27
|
-
| `page` | int | 1 | Page number |
|
|
28
|
-
| `per_page` | int | 50 | Items per page (1-10000) |
|
|
29
|
-
| `search` | text | "" | Search filter |
|
|
30
|
-
| `sort` | enum | "created_at" | Sort field |
|
|
31
|
-
| `order` | enum | "desc" | Sort order |
|
|
32
|
-
| `tools` | bool | true | Include tool information |
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Get Agent
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
GET /workspace/{workspace_id}/agent/{agent_id}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Query Parameters:**
|
|
43
|
-
- `tools` (bool, default: true): Include tool information
|
|
44
|
-
|
|
45
|
-
Returns agent definition including LLM configuration and XanoScript.
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## Create Agent
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
POST /workspace/{workspace_id}/agent
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**Content-Type:** `text/x-xanoscript`
|
|
56
|
-
|
|
57
|
-
**Query Parameters:**
|
|
58
|
-
- `branch` (text): Target branch label
|
|
59
|
-
- `tools` (bool): Include tool information in response
|
|
60
|
-
|
|
61
|
-
### XanoScript Agent Syntax
|
|
62
|
-
|
|
63
|
-
```xanoscript
|
|
64
|
-
agent foo {
|
|
65
|
-
canonical = "custom"
|
|
66
|
-
llm = {
|
|
67
|
-
type : "anthropic"
|
|
68
|
-
system_prompt: "You are a helpful AI Agent."
|
|
69
|
-
max_steps : 5
|
|
70
|
-
prompt : ""
|
|
71
|
-
model : "claude-4-sonnet-20250514"
|
|
72
|
-
temperature : 1
|
|
73
|
-
reasoning : true
|
|
74
|
-
baseURL : ""
|
|
75
|
-
headers : ""
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### LLM Configuration
|
|
81
|
-
|
|
82
|
-
| Field | Type | Description |
|
|
83
|
-
|-------|------|-------------|
|
|
84
|
-
| `type` | text | LLM provider: "anthropic", "openai", etc. |
|
|
85
|
-
| `system_prompt` | text | Instructions for agent behavior |
|
|
86
|
-
| `max_steps` | int | Maximum tool calls per request |
|
|
87
|
-
| `model` | text | Model identifier |
|
|
88
|
-
| `temperature` | float | Response randomness (0-2) |
|
|
89
|
-
| `reasoning` | bool | Enable extended thinking |
|
|
90
|
-
| `baseURL` | text | Custom API endpoint (optional) |
|
|
91
|
-
| `headers` | text | Custom headers (optional) |
|
|
92
|
-
|
|
93
|
-
### Available LLM Providers
|
|
94
|
-
|
|
95
|
-
| Provider | Type Value |
|
|
96
|
-
|----------|------------|
|
|
97
|
-
| Anthropic | `"anthropic"` |
|
|
98
|
-
| OpenAI | `"openai"` |
|
|
99
|
-
|
|
100
|
-
### Example: Customer Support Agent
|
|
101
|
-
|
|
102
|
-
```xanoscript
|
|
103
|
-
agent support_bot {
|
|
104
|
-
canonical = "support"
|
|
105
|
-
llm = {
|
|
106
|
-
type : "anthropic"
|
|
107
|
-
system_prompt: "You are a customer support agent. Help users with their questions about our products. Be friendly and professional."
|
|
108
|
-
max_steps : 10
|
|
109
|
-
model : "claude-4-sonnet-20250514"
|
|
110
|
-
temperature : 0.7
|
|
111
|
-
reasoning : true
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Example: Data Analysis Agent
|
|
117
|
-
|
|
118
|
-
```xanoscript
|
|
119
|
-
agent data_analyst {
|
|
120
|
-
canonical = "analyst"
|
|
121
|
-
llm = {
|
|
122
|
-
type : "anthropic"
|
|
123
|
-
system_prompt: "You are a data analyst. Help users understand their data by running queries and providing insights. Always explain your findings clearly."
|
|
124
|
-
max_steps : 15
|
|
125
|
-
model : "claude-4-sonnet-20250514"
|
|
126
|
-
temperature : 0.3
|
|
127
|
-
reasoning : true
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Update Agent
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
PUT /workspace/{workspace_id}/agent/{agent_id}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**Query Parameters:**
|
|
141
|
-
- `publish` (bool, default: true): Publish changes immediately
|
|
142
|
-
- `tools` (bool, default: true): Include tool information in response
|
|
143
|
-
|
|
144
|
-
**Content-Type:** `text/x-xanoscript`
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Delete Agent
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
DELETE /workspace/{workspace_id}/agent/{agent_id}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**Warning:** This action cannot be undone.
|