@xano/developer-mcp 1.0.27 → 1.0.29
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 +1 -1
- package/dist/api_docs/format.d.ts +5 -0
- package/dist/api_docs/format.js +171 -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/meta_api_docs/topics/branch.js +154 -18
- package/dist/meta_api_docs/topics/workspace.js +45 -2
- package/dist/templates/init-workspace.d.ts +10 -0
- package/dist/templates/init-workspace.js +278 -0
- package/dist/templates/xanoscript-index.d.ts +11 -0
- package/dist/templates/xanoscript-index.js +72 -0
- package/dist/xanoscript_docs/README.md +3 -13
- package/dist/xanoscript_docs/ephemeral.md +330 -0
- package/dist/xanoscript_docs/functions.md +0 -21
- package/dist/xanoscript_docs/integrations.md +0 -10
- package/dist/xanoscript_docs/performance.md +1 -10
- package/dist/xanoscript_docs/realtime.md +1 -48
- package/dist/xanoscript_docs/security.md +2 -0
- package/dist/xanoscript_docs/tools.md +2 -21
- package/dist/xanoscript_docs/triggers.md +2 -27
- package/dist/xanoscript_docs_auto/README.md +119 -0
- package/dist/xanoscript_docs_auto/agents.md +446 -0
- package/dist/xanoscript_docs_auto/apis.md +517 -0
- package/dist/xanoscript_docs_auto/control-flow.md +543 -0
- package/dist/xanoscript_docs_auto/database.md +551 -0
- package/dist/xanoscript_docs_auto/debugging.md +527 -0
- package/dist/xanoscript_docs_auto/filters.md +464 -0
- package/dist/xanoscript_docs_auto/functions.md +431 -0
- package/dist/xanoscript_docs_auto/integrations.md +657 -0
- package/dist/xanoscript_docs_auto/mcp-servers.md +408 -0
- package/dist/xanoscript_docs_auto/operators.md +368 -0
- package/dist/xanoscript_docs_auto/syntax.md +287 -0
- package/dist/xanoscript_docs_auto/tables.md +447 -0
- package/dist/xanoscript_docs_auto/tasks.md +479 -0
- package/dist/xanoscript_docs_auto/testing.md +574 -0
- package/dist/xanoscript_docs_auto/tools.md +485 -0
- package/dist/xanoscript_docs_auto/triggers.md +595 -0
- package/dist/xanoscript_docs_auto/types.md +323 -0
- package/dist/xanoscript_docs_auto/variables.md +462 -0
- package/dist/xanoscript_docs_auto/version.json +5 -0
- package/package.json +1 -1
|
@@ -87,27 +87,6 @@ input {
|
|
|
87
87
|
}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
### Empty and Single-Input Blocks
|
|
91
|
-
|
|
92
|
-
Empty input blocks and single-input blocks can be written as one-liners. However, when there are two or more inputs, each must be on its own line.
|
|
93
|
-
|
|
94
|
-
```xs
|
|
95
|
-
// OK - empty input as one-liner
|
|
96
|
-
input {}
|
|
97
|
-
|
|
98
|
-
// OK - single input as one-liner
|
|
99
|
-
input { email email_input? filters=trim|lower }
|
|
100
|
-
|
|
101
|
-
// OK - multiple inputs on separate lines
|
|
102
|
-
input {
|
|
103
|
-
email email_input? filters=trim|lower
|
|
104
|
-
text name
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// WRONG - multiple inputs on one line will cause parsing errors
|
|
108
|
-
input { email email_input? filters=trim|lower text name }
|
|
109
|
-
```
|
|
110
|
-
|
|
111
90
|
---
|
|
112
91
|
|
|
113
92
|
## Stack Block
|
|
@@ -506,16 +506,6 @@ security.check_password {
|
|
|
506
506
|
} as $is_valid
|
|
507
507
|
```
|
|
508
508
|
|
|
509
|
-
### Auth Tokens
|
|
510
|
-
```xs
|
|
511
|
-
security.create_auth_token {
|
|
512
|
-
table = "user"
|
|
513
|
-
id = $user.id
|
|
514
|
-
extras = { role: $user.role }
|
|
515
|
-
expiration = 86400
|
|
516
|
-
} as $token
|
|
517
|
-
```
|
|
518
|
-
|
|
519
509
|
### Encryption
|
|
520
510
|
```xs
|
|
521
511
|
# Encrypt
|
|
@@ -276,16 +276,7 @@ api.request {
|
|
|
276
276
|
|
|
277
277
|
## Rate Limiting
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
```xs
|
|
282
|
-
redis.ratelimit {
|
|
283
|
-
key = "api:" ~ $auth.id
|
|
284
|
-
max = 100
|
|
285
|
-
ttl = 60
|
|
286
|
-
error = "Rate limit exceeded. Try again in 1 minute."
|
|
287
|
-
}
|
|
288
|
-
```
|
|
279
|
+
For basic rate limiting setup, see `xanoscript_docs({ topic: "security" })`. Below are performance-focused patterns.
|
|
289
280
|
|
|
290
281
|
### Tiered Limits
|
|
291
282
|
|
|
@@ -261,54 +261,7 @@ api.realtime_event {
|
|
|
261
261
|
|
|
262
262
|
## Realtime Triggers
|
|
263
263
|
|
|
264
|
-
Handle events from connected clients
|
|
265
|
-
|
|
266
|
-
### Basic Realtime Trigger
|
|
267
|
-
|
|
268
|
-
```xs
|
|
269
|
-
realtime_trigger "on_presence" {
|
|
270
|
-
channel = "room:*"
|
|
271
|
-
event = "join"
|
|
272
|
-
stack {
|
|
273
|
-
// $input contains event data
|
|
274
|
-
// $channel contains matched channel
|
|
275
|
-
db.add "presence" {
|
|
276
|
-
data = {
|
|
277
|
-
user_id: $auth.id,
|
|
278
|
-
room_id: $input.room_id,
|
|
279
|
-
joined_at: now
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// Notify room members
|
|
284
|
-
api.realtime_event {
|
|
285
|
-
channel = $channel
|
|
286
|
-
event = "user_joined"
|
|
287
|
-
data = { user_id: $auth.id }
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### Channel Pattern Matching
|
|
294
|
-
|
|
295
|
-
```xs
|
|
296
|
-
realtime_trigger "document_cursor" {
|
|
297
|
-
channel = "document:*" // Wildcard match
|
|
298
|
-
event = "cursor_move"
|
|
299
|
-
stack {
|
|
300
|
-
// Broadcast cursor position to other viewers
|
|
301
|
-
api.realtime_event {
|
|
302
|
-
channel = $channel
|
|
303
|
-
event = "cursor_update"
|
|
304
|
-
data = {
|
|
305
|
-
user_id: $auth.id,
|
|
306
|
-
position: $input.position
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
```
|
|
264
|
+
Handle events from connected clients using `realtime_trigger`. For complete trigger syntax, input schemas, and configuration options, see `xanoscript_docs({ topic: "triggers" })`.
|
|
312
265
|
|
|
313
266
|
---
|
|
314
267
|
|
|
@@ -74,27 +74,6 @@ input {
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
### Empty and Single-Input Blocks
|
|
78
|
-
|
|
79
|
-
Empty input blocks and single-input blocks can be written as one-liners. When there are two or more inputs, each must be on its own line.
|
|
80
|
-
|
|
81
|
-
```xs
|
|
82
|
-
// OK - empty input
|
|
83
|
-
tool "get_system_status" {
|
|
84
|
-
description = "Get current system status"
|
|
85
|
-
instructions = "Use this to check if the system is healthy"
|
|
86
|
-
input {}
|
|
87
|
-
stack { ... }
|
|
88
|
-
response = $status
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// OK - single input as one-liner
|
|
92
|
-
input { text query filters=trim }
|
|
93
|
-
|
|
94
|
-
// WRONG - multiple inputs on one line will cause parsing errors
|
|
95
|
-
input { text query filters=trim int limit }
|
|
96
|
-
```
|
|
97
|
-
|
|
98
77
|
---
|
|
99
78
|
|
|
100
79
|
## Tool-Specific Statements
|
|
@@ -275,6 +254,8 @@ tool "get_order_with_items" {
|
|
|
275
254
|
|
|
276
255
|
## Error Handling
|
|
277
256
|
|
|
257
|
+
For complete error handling reference (preconditions, try-catch, throw, error types), see `xanoscript_docs({ topic: "syntax" })`.
|
|
258
|
+
|
|
278
259
|
```xs
|
|
279
260
|
tool "cancel_order" {
|
|
280
261
|
instructions = "Cancel an order. Only works for pending orders."
|
|
@@ -43,34 +43,9 @@ input {
|
|
|
43
43
|
| `action` | enum | The action that triggered: `insert`, `update`, `delete`, or `truncate` |
|
|
44
44
|
| `datasource` | text | The datasource name where the change occurred |
|
|
45
45
|
|
|
46
|
-
### Agent Trigger Input
|
|
46
|
+
### Agent Trigger Input / MCP Server Trigger Input
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
input {
|
|
50
|
-
object toolset {
|
|
51
|
-
schema {
|
|
52
|
-
int id
|
|
53
|
-
text name
|
|
54
|
-
text instructions
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
object[] tools {
|
|
59
|
-
schema {
|
|
60
|
-
int id
|
|
61
|
-
text name
|
|
62
|
-
text instructions
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
| Field | Type | Description |
|
|
69
|
-
|-------|------|-------------|
|
|
70
|
-
| `toolset` | object | The toolset configuration with id, name, and instructions |
|
|
71
|
-
| `tools` | object[] | Array of available tools with their id, name, and instructions |
|
|
72
|
-
|
|
73
|
-
### MCP Server Trigger Input
|
|
48
|
+
Agent triggers and MCP server triggers share the same input schema:
|
|
74
49
|
|
|
75
50
|
```xs
|
|
76
51
|
input {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# XanoScript Complete Reference
|
|
2
|
+
|
|
3
|
+
XanoScript is a declarative, statically-typed scripting language for [Xano](https://xano.com). It enables developers to build API endpoints, functions, scheduled tasks, database operations, and AI agents with structured, readable syntax.
|
|
4
|
+
|
|
5
|
+
## Quick Reference
|
|
6
|
+
|
|
7
|
+
### Top-Level Object Types
|
|
8
|
+
|
|
9
|
+
| Type | File Location | Purpose |
|
|
10
|
+
|------|---------------|---------|
|
|
11
|
+
| `query` | `apis/<group>/*.xs` | HTTP API endpoints with verbs, input, processing, response |
|
|
12
|
+
| `function` | `functions/**/*.xs` | Reusable logic blocks with optional testing |
|
|
13
|
+
| `task` | `tasks/*.xs` | Scheduled operations with cron-like triggers |
|
|
14
|
+
| `table` | `tables/*.xs` | Database schema definitions |
|
|
15
|
+
| `table_trigger` | `triggers/**/*.xs` | Trigger handlers for database events |
|
|
16
|
+
| `agent` | `agents/**/*.xs` | AI agent definitions |
|
|
17
|
+
| `tool` | `tools/**/*.xs` | Tool definitions for AI agents |
|
|
18
|
+
| `mcp_server` | `mcp_servers/**/*.xs` | Model Context Protocol server definitions |
|
|
19
|
+
| `middleware` | `middleware/**/*.xs` | Request/response interceptors |
|
|
20
|
+
| `addon` | `addons/*.xs` | Subqueries for related data |
|
|
21
|
+
| `branch` | `branch.xs` | Branch-level configuration |
|
|
22
|
+
| `workspace` | `workspace.xs` | Workspace-level settings |
|
|
23
|
+
| `realtime_channel` | Configuration | Real-time channel definitions |
|
|
24
|
+
| `api_group` | `apis/<group>/` | Collections of related API endpoints |
|
|
25
|
+
|
|
26
|
+
**Important:** Each `.xs` file must contain exactly one definition.
|
|
27
|
+
|
|
28
|
+
### Block Structure
|
|
29
|
+
|
|
30
|
+
```xs
|
|
31
|
+
<construct> "<name>" {
|
|
32
|
+
input { ... } // Parameters (optional)
|
|
33
|
+
stack { ... } // Logic
|
|
34
|
+
response = $var // Output
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Variable Access
|
|
39
|
+
|
|
40
|
+
```xs
|
|
41
|
+
$input.field // Input parameters
|
|
42
|
+
$var.name // Stack variables (in some contexts)
|
|
43
|
+
$auth.id // Authenticated user ID
|
|
44
|
+
$env.MY_VAR // Environment variable
|
|
45
|
+
$db.table.field // Database field reference (in queries)
|
|
46
|
+
$this // Current item in loops/maps
|
|
47
|
+
$error // Error information (in catch blocks)
|
|
48
|
+
now // Current timestamp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Language Blocks (Clauses)
|
|
52
|
+
|
|
53
|
+
| Block | Purpose |
|
|
54
|
+
|-------|---------|
|
|
55
|
+
| `stack` | Container for sequential operations |
|
|
56
|
+
| `input` | Define parameters with types and validation |
|
|
57
|
+
| `schema` | Database table schema |
|
|
58
|
+
| `response` | Specify output data |
|
|
59
|
+
| `schedule` | Execution times for tasks |
|
|
60
|
+
| `security` | Authentication and permissions |
|
|
61
|
+
| `auth` | Authentication configuration |
|
|
62
|
+
| `cache` | Caching configuration |
|
|
63
|
+
| `history` | History tracking |
|
|
64
|
+
| `index` | Database index definitions |
|
|
65
|
+
| `test` | Test definitions |
|
|
66
|
+
| `view` | View definitions |
|
|
67
|
+
| `middleware` | Middleware configuration |
|
|
68
|
+
|
|
69
|
+
## Workspace Structure
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
project/
|
|
73
|
+
├── workspace.xs // Workspace configuration
|
|
74
|
+
├── branch.xs // Branch configuration
|
|
75
|
+
├── tables/ // Database table schemas
|
|
76
|
+
├── functions/ // Reusable functions (supports subfolders)
|
|
77
|
+
├── apis/
|
|
78
|
+
│ └── <api-group>/ // API endpoints grouped by domain
|
|
79
|
+
├── tasks/ // Scheduled jobs
|
|
80
|
+
├── triggers/ // Event-driven handlers
|
|
81
|
+
├── agents/ // AI agents
|
|
82
|
+
├── tools/ // AI tools
|
|
83
|
+
├── mcp_servers/ // MCP server definitions
|
|
84
|
+
├── middleware/ // Request/response interceptors
|
|
85
|
+
├── addons/ // Query addons
|
|
86
|
+
├── static/ // Frontend files
|
|
87
|
+
└── run/ // Job and service configurations
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Comments
|
|
91
|
+
|
|
92
|
+
```xs
|
|
93
|
+
// Single-line comment
|
|
94
|
+
/* Multi-line comment */
|
|
95
|
+
var $total { value = 0 } // Inline comment
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Documentation Topics
|
|
99
|
+
|
|
100
|
+
| Topic | Description |
|
|
101
|
+
|-------|-------------|
|
|
102
|
+
| `syntax` | Expressions, operators, filters |
|
|
103
|
+
| `types` | Data types and validation |
|
|
104
|
+
| `operators` | Comparison, logical, math operators |
|
|
105
|
+
| `filters` | Pipe filters for transformations |
|
|
106
|
+
| `control-flow` | Conditionals, loops, error handling |
|
|
107
|
+
| `functions` | Function definitions and calls |
|
|
108
|
+
| `database` | All db.* operations |
|
|
109
|
+
| `apis` | HTTP endpoint definitions |
|
|
110
|
+
| `tables` | Database schema definitions |
|
|
111
|
+
| `tasks` | Scheduled jobs |
|
|
112
|
+
| `triggers` | Event-driven handlers |
|
|
113
|
+
| `agents` | AI agent configuration |
|
|
114
|
+
| `tools` | AI tools for agents |
|
|
115
|
+
| `mcp-servers` | MCP server definitions |
|
|
116
|
+
| `integrations` | Cloud storage, Redis, external APIs |
|
|
117
|
+
| `security-functions` | Encryption, hashing, auth tokens |
|
|
118
|
+
| `testing` | Unit tests and assertions |
|
|
119
|
+
| `variables` | System and built-in variables |
|