@xano/developer-mcp 1.0.19 โ 1.0.21
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 +38 -2
- package/dist/index.js +15 -0
- package/dist/templates/init-workspace.js +4 -4
- package/dist/templates/xanoscript-index.d.ts +3 -1
- package/dist/templates/xanoscript-index.js +54 -51
- package/dist/xanoscript_docs/README.md +51 -37
- package/dist/xanoscript_docs/apis.md +6 -3
- package/dist/xanoscript_docs/branch.md +239 -0
- package/dist/xanoscript_docs/functions.md +2 -2
- package/dist/xanoscript_docs/middleware.md +321 -0
- package/dist/xanoscript_docs/realtime.md +113 -1
- package/dist/xanoscript_docs/tools.md +1 -1
- package/dist/xanoscript_docs/types.md +25 -8
- package/dist/xanoscript_docs/workspace.md +209 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# ๐ Xano Developer MCP
|
|
4
|
+
|
|
5
|
+
**Supercharge your AI with the power of Xano**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@xano/developer-mcp)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
๐ค **AI-Powered** ยท ๐ **Comprehensive Docs** ยท โก **Instant Setup** ยท ๐ง **Built-in Tools**
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
An MCP server that gives AI assistants superpowers for developing on [Xano](https://xano.com) โ complete with documentation, code validation, and workflow guides.
|
|
19
|
+
|
|
20
|
+
> ๐ก **What's Xano?** The fastest way to build a scalable backend for your app โ no code required. Build APIs, manage databases, and deploy instantly.
|
|
21
|
+
|
|
22
|
+
### ๐ Quick Links
|
|
23
|
+
|
|
24
|
+
| ๐ [Website](https://xano.com) | ๐ [Docs](https://docs.xano.com/) | ๐ [Blog](https://www.xano.com/blog/) | ๐ฌ [Community](https://community.xano.com/) | ๐ฆ [npm](https://www.npmjs.com/package/@xano/developer-mcp) |
|
|
25
|
+
|:---:|:---:|:---:|:---:|:---:|
|
|
4
26
|
|
|
5
27
|
## Overview
|
|
6
28
|
|
|
@@ -22,6 +44,20 @@ claude mcp add xano-developer -- npx -y @xano/developer-mcp
|
|
|
22
44
|
|
|
23
45
|
That's it! The MCP server will be automatically installed and configured.
|
|
24
46
|
|
|
47
|
+
### Install via npm
|
|
48
|
+
|
|
49
|
+
You can also install the package globally from npm:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install -g @xano/developer-mcp
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then add to Claude Code:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
claude mcp add xano-developer -- xano-developer-mcp
|
|
59
|
+
```
|
|
60
|
+
|
|
25
61
|
### Claude Desktop
|
|
26
62
|
|
|
27
63
|
Add to your Claude Desktop configuration file:
|
package/dist/index.js
CHANGED
|
@@ -134,6 +134,21 @@ const XANOSCRIPT_DOCS_V2 = {
|
|
|
134
134
|
applyTo: ["functions/**/*.xs", "apis/**/*.xs"],
|
|
135
135
|
description: "Streaming data from files, requests, and responses",
|
|
136
136
|
},
|
|
137
|
+
middleware: {
|
|
138
|
+
file: "middleware.md",
|
|
139
|
+
applyTo: ["middleware/**/*.xs"],
|
|
140
|
+
description: "Request/response interceptors for functions, queries, tasks, and tools",
|
|
141
|
+
},
|
|
142
|
+
branch: {
|
|
143
|
+
file: "branch.md",
|
|
144
|
+
applyTo: ["branch.xs"],
|
|
145
|
+
description: "Branch-level settings: middleware, history retention, visual styling",
|
|
146
|
+
},
|
|
147
|
+
workspace: {
|
|
148
|
+
file: "workspace.md",
|
|
149
|
+
applyTo: ["workspace.xs"],
|
|
150
|
+
description: "Workspace-level settings: environment variables, preferences, realtime",
|
|
151
|
+
},
|
|
137
152
|
};
|
|
138
153
|
// =============================================================================
|
|
139
154
|
// Path Resolution
|
|
@@ -260,10 +260,10 @@ const response = await fetch(
|
|
|
260
260
|
For writing XanoScript code, use:
|
|
261
261
|
|
|
262
262
|
- \`xanoscript_docs()\` - Full documentation index
|
|
263
|
-
- \`xanoscript_docs({
|
|
264
|
-
- \`xanoscript_docs({
|
|
265
|
-
- \`xanoscript_docs({
|
|
266
|
-
- \`xanoscript_docs({
|
|
263
|
+
- \`xanoscript_docs({ topic: "functions" })\` - Function syntax
|
|
264
|
+
- \`xanoscript_docs({ topic: "tables" })\` - Table schema syntax
|
|
265
|
+
- \`xanoscript_docs({ topic: "apis" })\` - API endpoint syntax
|
|
266
|
+
- \`xanoscript_docs({ topic: "syntax" })\` - Language reference
|
|
267
267
|
|
|
268
268
|
## Validating XanoScript
|
|
269
269
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Template for xanoscript_docs index documentation
|
|
3
3
|
* Edit this file to update the XanoScript documentation index
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This template is currently unused. The actual documentation is served
|
|
6
|
+
* directly from the XANOSCRIPT_DOCS_V2 config in index.ts.
|
|
4
7
|
*/
|
|
5
8
|
export interface XanoscriptIndexParams {
|
|
6
9
|
version: string;
|
|
7
|
-
aliasLookup: Record<string, string[]>;
|
|
8
10
|
}
|
|
9
11
|
export declare function generateXanoscriptIndexTemplate(params: XanoscriptIndexParams): string;
|
|
@@ -1,69 +1,72 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Template for xanoscript_docs index documentation
|
|
3
3
|
* Edit this file to update the XanoScript documentation index
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This template is currently unused. The actual documentation is served
|
|
6
|
+
* directly from the XANOSCRIPT_DOCS_V2 config in index.ts.
|
|
4
7
|
*/
|
|
5
8
|
export function generateXanoscriptIndexTemplate(params) {
|
|
6
|
-
const { version
|
|
7
|
-
const formatRow = (keyword, description) => {
|
|
8
|
-
const aliases = aliasLookup[keyword]?.slice(0, 3).join(", ") || "";
|
|
9
|
-
return `| \`${keyword}\` | ${aliases ? aliases : "-"} | ${description} |`;
|
|
10
|
-
};
|
|
9
|
+
const { version } = params;
|
|
11
10
|
return `# XanoScript Documentation Index
|
|
12
11
|
Version: ${version}
|
|
13
12
|
|
|
14
|
-
Use \`xanoscript_docs
|
|
13
|
+
Use \`xanoscript_docs({ topic: "<topic>" })\` to retrieve documentation.
|
|
15
14
|
|
|
16
|
-
## Core
|
|
17
|
-
|
|
15
|
+
## Core Language
|
|
16
|
+
| Topic | Description |
|
|
17
|
+
|-------|-------------|
|
|
18
|
+
| \`syntax\` | Expressions, operators, filters, system variables |
|
|
19
|
+
| \`types\` | Data types, validation, input blocks |
|
|
20
|
+
| \`functions\` | Reusable function stacks, async, loops |
|
|
21
|
+
| \`schema\` | Runtime schema parsing and validation |
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
${formatRow("tool", "AI-callable tools in `tools/`")}
|
|
27
|
-
${formatRow("agent", "AI agents in `agents/`")}
|
|
28
|
-
${formatRow("mcp_server", "MCP servers in `mcp_servers/`")}
|
|
23
|
+
## Data
|
|
24
|
+
| Topic | Description |
|
|
25
|
+
|-------|-------------|
|
|
26
|
+
| \`tables\` | Database schema definitions with indexes and relationships |
|
|
27
|
+
| \`database\` | All db.* operations: query, get, add, edit, patch, delete |
|
|
28
|
+
| \`addons\` | Reusable subqueries for fetching related data |
|
|
29
|
+
| \`streaming\` | Streaming data from files, requests, and responses |
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
-
|
|
31
|
+
## APIs & Endpoints
|
|
32
|
+
| Topic | Description |
|
|
33
|
+
|-------|-------------|
|
|
34
|
+
| \`apis\` | HTTP endpoint definitions with authentication and CRUD patterns |
|
|
35
|
+
| \`tasks\` | Scheduled and cron jobs |
|
|
36
|
+
| \`triggers\` | Event-driven handlers (table, realtime, workspace, agent, MCP) |
|
|
37
|
+
| \`realtime\` | Real-time channels and events for push updates |
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
${formatRow("query_filter", "WHERE clause and filter syntax")}
|
|
39
|
+
## AI & Agents
|
|
40
|
+
| Topic | Description |
|
|
41
|
+
|-------|-------------|
|
|
42
|
+
| \`agents\` | AI agent configuration with LLM providers and tools |
|
|
43
|
+
| \`tools\` | AI tools for agents and MCP servers |
|
|
44
|
+
| \`mcp-servers\` | MCP server definitions exposing tools |
|
|
40
45
|
|
|
41
|
-
##
|
|
42
|
-
|
|
46
|
+
## Integrations
|
|
47
|
+
| Topic | Description |
|
|
48
|
+
|-------|-------------|
|
|
49
|
+
| \`integrations\` | Cloud storage, Redis, security, and external APIs |
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
${formatRow("task_workflow", "AI workflow for creating tasks")}
|
|
51
|
+
## Configuration
|
|
52
|
+
| Topic | Description |
|
|
53
|
+
|-------|-------------|
|
|
54
|
+
| \`workspace\` | Workspace-level settings: environment variables, preferences, realtime |
|
|
55
|
+
| \`branch\` | Branch-level settings: middleware, history retention, visual styling |
|
|
56
|
+
| \`middleware\` | Request/response interceptors for functions, queries, tasks, and tools |
|
|
51
57
|
|
|
52
|
-
##
|
|
58
|
+
## Development
|
|
59
|
+
| Topic | Description |
|
|
60
|
+
|-------|-------------|
|
|
61
|
+
| \`testing\` | Unit tests, mocks, and assertions |
|
|
62
|
+
| \`debugging\` | Logging, inspecting, and debugging XanoScript execution |
|
|
63
|
+
| \`frontend\` | Static frontend development and deployment |
|
|
64
|
+
| \`run\` | Run job and service configurations for the Xano Job Runner |
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
${formatRow("lovable", "Building from Lovable-generated websites")}
|
|
60
|
-
${formatRow("performance", "Performance optimization best practices")}
|
|
61
|
-
${formatRow("realtime", "Real-time channels and events")}
|
|
62
|
-
${formatRow("schema", "Runtime schema parsing and validation")}
|
|
63
|
-
${formatRow("security", "Security best practices")}
|
|
64
|
-
${formatRow("streaming", "Streaming data from files and responses")}
|
|
65
|
-
${formatRow("testing", "Unit testing XanoScript code")}
|
|
66
|
-
${formatRow("tips", "Tips and tricks")}
|
|
67
|
-
${formatRow("run", "Run job and service configurations")}
|
|
66
|
+
## Best Practices
|
|
67
|
+
| Topic | Description |
|
|
68
|
+
|-------|-------------|
|
|
69
|
+
| \`performance\` | Performance optimization best practices |
|
|
70
|
+
| \`security\` | Security best practices for authentication and authorization |
|
|
68
71
|
`;
|
|
69
72
|
}
|
|
@@ -15,6 +15,10 @@ XanoScript is the declarative scripting language for [Xano](https://xano.com), a
|
|
|
15
15
|
| `tool` | `tools/**/*.xs` | Tools for AI agents |
|
|
16
16
|
| `mcp_server` | `mcp_servers/**/*.xs` | MCP server definitions |
|
|
17
17
|
| `addon` | `addons/*.xs` | Subqueries for related data |
|
|
18
|
+
| `middleware` | `middleware/**/*.xs` | Request/response interceptors |
|
|
19
|
+
| `branch` | `branch.xs` | Branch-level configuration |
|
|
20
|
+
| `workspace` | `workspace.xs` | Workspace-level configuration |
|
|
21
|
+
| `realtime_channel` | Configuration | Realtime channel settings |
|
|
18
22
|
|
|
19
23
|
**Important:** Each `.xs` file must contain exactly one definition. You cannot define multiple tables, functions, queries, or other constructs in a single file.
|
|
20
24
|
|
|
@@ -22,6 +26,8 @@ XanoScript is the declarative scripting language for [Xano](https://xano.com), a
|
|
|
22
26
|
|
|
23
27
|
```
|
|
24
28
|
project/
|
|
29
|
+
โโโ workspace.xs // Workspace configuration (env vars, preferences)
|
|
30
|
+
โโโ branch.xs // Branch configuration (middleware, history)
|
|
25
31
|
โโโ tables/ // Database table schemas
|
|
26
32
|
โโโ functions/ // Reusable functions (supports subfolders)
|
|
27
33
|
โโโ apis/
|
|
@@ -31,6 +37,7 @@ project/
|
|
|
31
37
|
โโโ agents/ // AI agents
|
|
32
38
|
โโโ tools/ // AI tools
|
|
33
39
|
โโโ mcp_servers/ // MCP server definitions
|
|
40
|
+
โโโ middleware/ // Request/response interceptors
|
|
34
41
|
โโโ addons/ // Query addons
|
|
35
42
|
โโโ static/ // Frontend files (HTML, CSS, JS)
|
|
36
43
|
โโโ run/ // Job and service configurations
|
|
@@ -103,54 +110,61 @@ This helps AI tools apply the correct documentation based on the file being edit
|
|
|
103
110
|
|
|
104
111
|
## Documentation Index
|
|
105
112
|
|
|
106
|
-
Use `xanoscript_docs({
|
|
113
|
+
Use `xanoscript_docs({ topic: "<topic>" })` to retrieve documentation.
|
|
107
114
|
|
|
108
115
|
### Core Language
|
|
109
|
-
| Topic |
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
116
|
+
| Topic | Description |
|
|
117
|
+
|-------|-------------|
|
|
118
|
+
| `syntax` | Expressions, operators, filters, system variables |
|
|
119
|
+
| `types` | Data types, validation, input blocks |
|
|
120
|
+
| `functions` | Reusable function stacks, async, loops |
|
|
121
|
+
| `schema` | Runtime schema parsing and validation |
|
|
115
122
|
|
|
116
123
|
### Data
|
|
117
|
-
| Topic |
|
|
118
|
-
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
124
|
+
| Topic | Description |
|
|
125
|
+
|-------|-------------|
|
|
126
|
+
| `tables` | Database schema definitions with indexes and relationships |
|
|
127
|
+
| `database` | All db.* operations: query, get, add, edit, patch, delete |
|
|
128
|
+
| `addons` | Reusable subqueries for fetching related data |
|
|
129
|
+
| `streaming` | Streaming data from files, requests, and responses |
|
|
123
130
|
|
|
124
131
|
### APIs & Endpoints
|
|
125
|
-
| Topic |
|
|
126
|
-
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
|
|
|
132
|
+
| Topic | Description |
|
|
133
|
+
|-------|-------------|
|
|
134
|
+
| `apis` | HTTP endpoint definitions with authentication and CRUD patterns |
|
|
135
|
+
| `tasks` | Scheduled and cron jobs |
|
|
136
|
+
| `triggers` | Event-driven handlers (table, realtime, workspace, agent, MCP) |
|
|
137
|
+
| `realtime` | Real-time channels and events for push updates |
|
|
131
138
|
|
|
132
139
|
### AI & Agents
|
|
133
|
-
| Topic |
|
|
134
|
-
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
140
|
+
| Topic | Description |
|
|
141
|
+
|-------|-------------|
|
|
142
|
+
| `agents` | AI agent configuration with LLM providers and tools |
|
|
143
|
+
| `tools` | AI tools for agents and MCP servers |
|
|
144
|
+
| `mcp-servers` | MCP server definitions exposing tools |
|
|
138
145
|
|
|
139
146
|
### Integrations
|
|
140
|
-
| Topic |
|
|
141
|
-
|
|
142
|
-
|
|
|
147
|
+
| Topic | Description |
|
|
148
|
+
|-------|-------------|
|
|
149
|
+
| `integrations` | Cloud storage, Redis, security, and external APIs |
|
|
150
|
+
|
|
151
|
+
### Configuration
|
|
152
|
+
| Topic | Description |
|
|
153
|
+
|-------|-------------|
|
|
154
|
+
| `workspace` | Workspace-level settings: environment variables, preferences, realtime |
|
|
155
|
+
| `branch` | Branch-level settings: middleware, history retention, visual styling |
|
|
156
|
+
| `middleware` | Request/response interceptors for functions, queries, tasks, and tools |
|
|
143
157
|
|
|
144
158
|
### Development
|
|
145
|
-
| Topic |
|
|
146
|
-
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
159
|
+
| Topic | Description |
|
|
160
|
+
|-------|-------------|
|
|
161
|
+
| `testing` | Unit tests, mocks, and assertions |
|
|
162
|
+
| `debugging` | Logging, inspecting, and debugging XanoScript execution |
|
|
163
|
+
| `frontend` | Static frontend development and deployment |
|
|
164
|
+
| `run` | Run job and service configurations for the Xano Job Runner |
|
|
151
165
|
|
|
152
166
|
### Best Practices
|
|
153
|
-
| Topic |
|
|
154
|
-
|
|
155
|
-
|
|
|
156
|
-
|
|
|
167
|
+
| Topic | Description |
|
|
168
|
+
|-------|-------------|
|
|
169
|
+
| `performance` | Performance optimization best practices |
|
|
170
|
+
| `security` | Security best practices for authentication and authorization |
|
|
@@ -86,7 +86,7 @@ query "products" verb=GET {
|
|
|
86
86
|
|
|
87
87
|
## Input Block
|
|
88
88
|
|
|
89
|
-
For complete type and filter reference, use `xanoscript_docs({
|
|
89
|
+
For complete type and filter reference, use `xanoscript_docs({ topic: "types" })`.
|
|
90
90
|
|
|
91
91
|
### Empty Input Blocks
|
|
92
92
|
|
|
@@ -345,11 +345,14 @@ stack {
|
|
|
345
345
|
|
|
346
346
|
## Error Handling
|
|
347
347
|
|
|
348
|
-
For complete error handling reference, use `xanoscript_docs({
|
|
348
|
+
For complete error handling reference, use `xanoscript_docs({ topic: "syntax" })`.
|
|
349
349
|
|
|
350
350
|
| Type | HTTP Status |
|
|
351
351
|
|------|-------------|
|
|
352
|
-
| `inputerror` | 400 |
|
|
352
|
+
| `inputerror` | 400 |
|
|
353
|
+
| `accessdenied` | 403 |
|
|
354
|
+
| `notfound` | 404 |
|
|
355
|
+
| `standard` | 500 |
|
|
353
356
|
|
|
354
357
|
---
|
|
355
358
|
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "branch.xs"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Branch Configuration
|
|
6
|
+
|
|
7
|
+
Configure branch-level settings including middleware, history retention, and visual styling.
|
|
8
|
+
|
|
9
|
+
## Quick Reference
|
|
10
|
+
|
|
11
|
+
```xs
|
|
12
|
+
branch "<name>" {
|
|
13
|
+
color = "#hex"
|
|
14
|
+
description = "Branch description"
|
|
15
|
+
middleware = { ... }
|
|
16
|
+
history = { ... }
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Attributes
|
|
21
|
+
| Attribute | Type | Required | Description |
|
|
22
|
+
|-----------|------|----------|-------------|
|
|
23
|
+
| `color` | text | Yes | Hex color code for branch identification |
|
|
24
|
+
| `description` | text | No | Human-readable branch description |
|
|
25
|
+
| `middleware` | object | No | Pre/post middleware configuration |
|
|
26
|
+
| `history` | object | No | Request history retention settings |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Basic Structure
|
|
31
|
+
|
|
32
|
+
```xs
|
|
33
|
+
branch "production" {
|
|
34
|
+
color = "#22c55e"
|
|
35
|
+
description = "Production environment"
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Middleware Configuration
|
|
42
|
+
|
|
43
|
+
Configure middleware to run before (pre) and after (post) different construct types.
|
|
44
|
+
|
|
45
|
+
### Syntax
|
|
46
|
+
|
|
47
|
+
```xs
|
|
48
|
+
branch "production" {
|
|
49
|
+
color = "#22c55e"
|
|
50
|
+
|
|
51
|
+
middleware = {
|
|
52
|
+
function: {
|
|
53
|
+
pre: ["auth_check", "rate_limit"],
|
|
54
|
+
post: ["audit_log"]
|
|
55
|
+
},
|
|
56
|
+
query: {
|
|
57
|
+
pre: ["auth_check", "rate_limit"],
|
|
58
|
+
post: ["audit_log", "cache_response"]
|
|
59
|
+
},
|
|
60
|
+
task: {
|
|
61
|
+
pre: ["task_lock"],
|
|
62
|
+
post: ["task_cleanup"]
|
|
63
|
+
},
|
|
64
|
+
tool: {
|
|
65
|
+
pre: ["tool_auth"],
|
|
66
|
+
post: ["tool_log"]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Middleware Targets
|
|
73
|
+
|
|
74
|
+
| Target | Description |
|
|
75
|
+
|--------|-------------|
|
|
76
|
+
| `function` | Applies to all function calls |
|
|
77
|
+
| `query` | Applies to all API endpoints |
|
|
78
|
+
| `task` | Applies to scheduled tasks |
|
|
79
|
+
| `tool` | Applies to AI agent tools |
|
|
80
|
+
|
|
81
|
+
### Pre vs Post Middleware
|
|
82
|
+
|
|
83
|
+
| Type | Execution | Use Cases |
|
|
84
|
+
|------|-----------|-----------|
|
|
85
|
+
| `pre` | Before main logic | Authentication, rate limiting, validation |
|
|
86
|
+
| `post` | After main logic | Logging, caching, response transformation |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## History Configuration
|
|
91
|
+
|
|
92
|
+
Control how many historical executions are retained for debugging and auditing.
|
|
93
|
+
|
|
94
|
+
### Syntax
|
|
95
|
+
|
|
96
|
+
```xs
|
|
97
|
+
branch "production" {
|
|
98
|
+
color = "#22c55e"
|
|
99
|
+
|
|
100
|
+
history = {
|
|
101
|
+
function: 100,
|
|
102
|
+
query: 1000,
|
|
103
|
+
task: 100,
|
|
104
|
+
tool: 100,
|
|
105
|
+
trigger: 100,
|
|
106
|
+
middleware: 10
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### History Values
|
|
112
|
+
|
|
113
|
+
| Value | Description |
|
|
114
|
+
|-------|-------------|
|
|
115
|
+
| `false` | Disable history (no retention) |
|
|
116
|
+
| `10` | Keep last 10 executions |
|
|
117
|
+
| `100` | Keep last 100 executions |
|
|
118
|
+
| `1000` | Keep last 1000 executions |
|
|
119
|
+
| `10000` | Keep last 10000 executions |
|
|
120
|
+
| `"all"` | Keep all executions (use with caution) |
|
|
121
|
+
|
|
122
|
+
### History Targets
|
|
123
|
+
|
|
124
|
+
| Target | Description |
|
|
125
|
+
|--------|-------------|
|
|
126
|
+
| `function` | Function execution history |
|
|
127
|
+
| `query` | API endpoint request history |
|
|
128
|
+
| `task` | Scheduled task execution history |
|
|
129
|
+
| `tool` | AI tool invocation history |
|
|
130
|
+
| `trigger` | Trigger execution history |
|
|
131
|
+
| `middleware` | Middleware execution history |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Common Patterns
|
|
136
|
+
|
|
137
|
+
### Development Branch
|
|
138
|
+
|
|
139
|
+
```xs
|
|
140
|
+
branch "development" {
|
|
141
|
+
color = "#3b82f6"
|
|
142
|
+
description = "Development environment with full debugging"
|
|
143
|
+
|
|
144
|
+
history = {
|
|
145
|
+
function: "all",
|
|
146
|
+
query: "all",
|
|
147
|
+
task: "all",
|
|
148
|
+
tool: "all",
|
|
149
|
+
trigger: "all",
|
|
150
|
+
middleware: "all"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Staging Branch
|
|
156
|
+
|
|
157
|
+
```xs
|
|
158
|
+
branch "staging" {
|
|
159
|
+
color = "#f59e0b"
|
|
160
|
+
description = "Staging environment for testing"
|
|
161
|
+
|
|
162
|
+
middleware = {
|
|
163
|
+
query: {
|
|
164
|
+
pre: ["auth_check"],
|
|
165
|
+
post: ["audit_log"]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
history = {
|
|
170
|
+
function: 1000,
|
|
171
|
+
query: 1000,
|
|
172
|
+
task: 100,
|
|
173
|
+
tool: 100,
|
|
174
|
+
trigger: 100,
|
|
175
|
+
middleware: 100
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Production Branch
|
|
181
|
+
|
|
182
|
+
```xs
|
|
183
|
+
branch "production" {
|
|
184
|
+
color = "#22c55e"
|
|
185
|
+
description = "Production environment"
|
|
186
|
+
|
|
187
|
+
middleware = {
|
|
188
|
+
function: {
|
|
189
|
+
pre: ["auth_check", "rate_limit"],
|
|
190
|
+
post: ["audit_log"]
|
|
191
|
+
},
|
|
192
|
+
query: {
|
|
193
|
+
pre: ["auth_check", "rate_limit", "security_check"],
|
|
194
|
+
post: ["audit_log", "cache_response"]
|
|
195
|
+
},
|
|
196
|
+
task: {
|
|
197
|
+
pre: ["task_lock"],
|
|
198
|
+
post: ["audit_log"]
|
|
199
|
+
},
|
|
200
|
+
tool: {
|
|
201
|
+
pre: ["auth_check"],
|
|
202
|
+
post: ["audit_log"]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
history = {
|
|
207
|
+
function: 100,
|
|
208
|
+
query: 100,
|
|
209
|
+
task: 100,
|
|
210
|
+
tool: 100,
|
|
211
|
+
trigger: 100,
|
|
212
|
+
middleware: false
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## File Location
|
|
220
|
+
|
|
221
|
+
Branch configuration files are typically named `branch.xs` and placed at the workspace root or in a dedicated configuration directory.
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
project/
|
|
225
|
+
โโโ branch.xs // Branch configuration
|
|
226
|
+
โโโ tables/
|
|
227
|
+
โโโ functions/
|
|
228
|
+
โโโ apis/
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Best Practices
|
|
234
|
+
|
|
235
|
+
1. **Use descriptive colors** - Green for production, blue for development, yellow for staging
|
|
236
|
+
2. **Limit production history** - Excessive history impacts performance and storage
|
|
237
|
+
3. **Apply security middleware in production** - Rate limiting, auth checks, audit logging
|
|
238
|
+
4. **Disable middleware history in production** - Reduces noise and storage
|
|
239
|
+
5. **Enable full history in development** - Aids debugging and testing
|
|
@@ -72,7 +72,7 @@ Reference with path: `function.run "math/add" { ... }`
|
|
|
72
72
|
|
|
73
73
|
## Input Block
|
|
74
74
|
|
|
75
|
-
For complete type and filter reference, use `xanoscript_docs({
|
|
75
|
+
For complete type and filter reference, use `xanoscript_docs({ topic: "types" })`.
|
|
76
76
|
|
|
77
77
|
```xs
|
|
78
78
|
input {
|
|
@@ -188,7 +188,7 @@ stack {
|
|
|
188
188
|
|
|
189
189
|
### Error Handling
|
|
190
190
|
|
|
191
|
-
For complete error handling reference (preconditions, try-catch, throw, early return), use `xanoscript_docs({
|
|
191
|
+
For complete error handling reference (preconditions, try-catch, throw, early return), use `xanoscript_docs({ topic: "syntax" })`.
|
|
192
192
|
|
|
193
193
|
---
|
|
194
194
|
|