@xano/developer-mcp 1.0.14 → 1.0.16
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 +56 -10
- package/dist/index.js +48 -9
- package/dist/meta_api_docs/format.d.ts +5 -0
- package/dist/meta_api_docs/format.js +171 -0
- package/dist/meta_api_docs/index.d.ts +52 -0
- package/dist/meta_api_docs/index.js +111 -0
- package/dist/meta_api_docs/topics/agent.d.ts +2 -0
- package/dist/meta_api_docs/topics/agent.js +142 -0
- package/dist/meta_api_docs/topics/api.d.ts +2 -0
- package/dist/meta_api_docs/topics/api.js +176 -0
- package/dist/meta_api_docs/topics/apigroup.d.ts +2 -0
- package/dist/meta_api_docs/topics/apigroup.js +124 -0
- package/dist/meta_api_docs/topics/authentication.d.ts +2 -0
- package/dist/meta_api_docs/topics/authentication.js +61 -0
- package/dist/meta_api_docs/topics/branch.d.ts +2 -0
- package/dist/meta_api_docs/topics/branch.js +73 -0
- package/dist/meta_api_docs/topics/file.d.ts +2 -0
- package/dist/meta_api_docs/topics/file.js +70 -0
- package/dist/meta_api_docs/topics/function.d.ts +2 -0
- package/dist/meta_api_docs/topics/function.js +164 -0
- package/dist/meta_api_docs/topics/history.d.ts +2 -0
- package/dist/meta_api_docs/topics/history.js +149 -0
- package/dist/meta_api_docs/topics/mcp_server.d.ts +2 -0
- package/dist/meta_api_docs/topics/mcp_server.js +139 -0
- package/dist/meta_api_docs/topics/middleware.d.ts +2 -0
- package/dist/meta_api_docs/topics/middleware.js +156 -0
- package/dist/meta_api_docs/topics/realtime.d.ts +2 -0
- package/dist/meta_api_docs/topics/realtime.js +112 -0
- package/dist/meta_api_docs/topics/start.d.ts +2 -0
- package/dist/meta_api_docs/topics/start.js +107 -0
- package/dist/meta_api_docs/topics/table.d.ts +2 -0
- package/dist/meta_api_docs/topics/table.js +195 -0
- package/dist/meta_api_docs/topics/task.d.ts +2 -0
- package/dist/meta_api_docs/topics/task.js +165 -0
- package/dist/meta_api_docs/topics/tool.d.ts +2 -0
- package/dist/meta_api_docs/topics/tool.js +150 -0
- package/dist/meta_api_docs/topics/workflows.d.ts +2 -0
- package/dist/meta_api_docs/topics/workflows.js +131 -0
- package/dist/meta_api_docs/topics/workspace.d.ts +2 -0
- package/dist/meta_api_docs/topics/workspace.js +153 -0
- package/dist/meta_api_docs/types.d.ts +79 -0
- package/dist/meta_api_docs/types.js +4 -0
- package/dist/run_api_docs/format.d.ts +5 -0
- package/dist/run_api_docs/format.js +175 -0
- package/dist/run_api_docs/index.d.ts +52 -0
- package/dist/run_api_docs/index.js +90 -0
- package/dist/run_api_docs/topics/data.d.ts +2 -0
- package/dist/run_api_docs/topics/data.js +104 -0
- package/dist/run_api_docs/topics/history.d.ts +2 -0
- package/dist/run_api_docs/topics/history.js +93 -0
- package/dist/run_api_docs/topics/run.d.ts +2 -0
- package/dist/run_api_docs/topics/run.js +110 -0
- package/dist/run_api_docs/topics/session.d.ts +2 -0
- package/dist/run_api_docs/topics/session.js +166 -0
- package/dist/run_api_docs/topics/start.d.ts +2 -0
- package/dist/run_api_docs/topics/start.js +97 -0
- package/dist/run_api_docs/topics/workflows.d.ts +2 -0
- package/dist/run_api_docs/topics/workflows.js +140 -0
- package/dist/templates/xanoscript-index.js +1 -1
- package/dist/xanoscript_docs/README.md +2 -2
- package/dist/xanoscript_docs/run.md +357 -0
- package/package.json +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export const middlewareDoc = {
|
|
2
|
+
topic: "middleware",
|
|
3
|
+
title: "Middleware Management",
|
|
4
|
+
description: `Middleware are request/response interceptors that run before or after API endpoints. They handle cross-cutting concerns like authentication, logging, rate limiting, and request transformation.
|
|
5
|
+
|
|
6
|
+
## Key Concepts
|
|
7
|
+
- Middleware runs before (pre) or after (post) API endpoints
|
|
8
|
+
- Can modify requests, responses, or halt execution
|
|
9
|
+
- Used for: auth validation, logging, rate limiting, CORS, etc.
|
|
10
|
+
- Can be applied to specific endpoints or entire API groups
|
|
11
|
+
- Support draft/publish workflow
|
|
12
|
+
|
|
13
|
+
## Common Middleware Patterns
|
|
14
|
+
- Authentication/authorization checks
|
|
15
|
+
- Request logging and timing
|
|
16
|
+
- Rate limiting
|
|
17
|
+
- Request/response transformation
|
|
18
|
+
- CORS handling
|
|
19
|
+
- Input validation`,
|
|
20
|
+
ai_hints: `- Middleware runs on every matching request - keep it fast
|
|
21
|
+
- Pre-middleware can halt execution (auth checks)
|
|
22
|
+
- Post-middleware can transform responses
|
|
23
|
+
- Check existing middleware before creating duplicates
|
|
24
|
+
- Security settings control which endpoints use the middleware`,
|
|
25
|
+
endpoints: [
|
|
26
|
+
{
|
|
27
|
+
method: "GET",
|
|
28
|
+
path: "/workspace/{workspace_id}/middleware",
|
|
29
|
+
tool_name: "listMiddlewares",
|
|
30
|
+
description: "List all middleware in a workspace.",
|
|
31
|
+
parameters: [
|
|
32
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
33
|
+
{ name: "page", type: "integer", default: 1, description: "Page number" },
|
|
34
|
+
{ name: "per_page", type: "integer", default: 50, description: "Items per page" },
|
|
35
|
+
{ name: "search", type: "string", description: "Search by name" },
|
|
36
|
+
{ name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript code" },
|
|
37
|
+
{ name: "include_draft", type: "boolean", default: false, description: "Include draft versions" }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: "/workspace/{workspace_id}/middleware/{middleware_id}",
|
|
43
|
+
tool_name: "getMiddleware",
|
|
44
|
+
description: "Get details of a specific middleware.",
|
|
45
|
+
parameters: [
|
|
46
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
47
|
+
{ name: "middleware_id", type: "integer", required: true, in: "path", description: "Middleware ID" },
|
|
48
|
+
{ name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript code" },
|
|
49
|
+
{ name: "include_draft", type: "boolean", default: false, description: "Include draft version" }
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
method: "POST",
|
|
54
|
+
path: "/workspace/{workspace_id}/middleware",
|
|
55
|
+
tool_name: "createMiddleware",
|
|
56
|
+
description: "Create a new middleware.",
|
|
57
|
+
parameters: [
|
|
58
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" }
|
|
59
|
+
],
|
|
60
|
+
request_body: {
|
|
61
|
+
type: "application/json",
|
|
62
|
+
properties: {
|
|
63
|
+
name: { type: "string", description: "Middleware name", required: true },
|
|
64
|
+
description: { type: "string", description: "Middleware description" },
|
|
65
|
+
type: { type: "string", description: "pre or post", required: true },
|
|
66
|
+
xanoscript: { type: "string", description: "XanoScript middleware definition", required: true }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
example: {
|
|
70
|
+
method: "POST",
|
|
71
|
+
path: "/workspace/1/middleware",
|
|
72
|
+
body: {
|
|
73
|
+
name: "rate_limiter",
|
|
74
|
+
description: "Limit requests to 100 per minute per IP",
|
|
75
|
+
type: "pre",
|
|
76
|
+
xanoscript: `middleware rate_limiter {
|
|
77
|
+
stack {
|
|
78
|
+
var $key {
|
|
79
|
+
value = "ratelimit:" + $request.ip
|
|
80
|
+
}
|
|
81
|
+
var $count {
|
|
82
|
+
value = redis.incr($key)
|
|
83
|
+
}
|
|
84
|
+
if ($count == 1) {
|
|
85
|
+
redis.expire($key, 60)
|
|
86
|
+
}
|
|
87
|
+
if ($count > 100) {
|
|
88
|
+
throw(429, "Rate limit exceeded")
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}`
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
method: "PUT",
|
|
97
|
+
path: "/workspace/{workspace_id}/middleware/{middleware_id}",
|
|
98
|
+
tool_name: "updateMiddleware",
|
|
99
|
+
description: "Update an existing middleware.",
|
|
100
|
+
parameters: [
|
|
101
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
102
|
+
{ name: "middleware_id", type: "integer", required: true, in: "path", description: "Middleware ID" },
|
|
103
|
+
{ name: "publish", type: "boolean", default: true, description: "Publish changes immediately" }
|
|
104
|
+
],
|
|
105
|
+
request_body: {
|
|
106
|
+
type: "application/json",
|
|
107
|
+
properties: {
|
|
108
|
+
name: { type: "string", description: "Middleware name" },
|
|
109
|
+
description: { type: "string", description: "Middleware description" },
|
|
110
|
+
xanoscript: { type: "string", description: "XanoScript middleware definition" }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
method: "DELETE",
|
|
116
|
+
path: "/workspace/{workspace_id}/middleware/{middleware_id}",
|
|
117
|
+
tool_name: "deleteMiddleware",
|
|
118
|
+
description: "Delete a middleware.",
|
|
119
|
+
parameters: [
|
|
120
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
121
|
+
{ name: "middleware_id", type: "integer", required: true, in: "path", description: "Middleware ID" }
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
method: "PUT",
|
|
126
|
+
path: "/workspace/{workspace_id}/middleware/{middleware_id}/security",
|
|
127
|
+
tool_name: "updateMiddlewareSecurity",
|
|
128
|
+
description: "Update security settings for the middleware.",
|
|
129
|
+
parameters: [
|
|
130
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
131
|
+
{ name: "middleware_id", type: "integer", required: true, in: "path", description: "Middleware ID" }
|
|
132
|
+
],
|
|
133
|
+
request_body: {
|
|
134
|
+
type: "application/json",
|
|
135
|
+
properties: {
|
|
136
|
+
guid: { type: "string", description: "Security group GUID" }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
schemas: {
|
|
142
|
+
Middleware: {
|
|
143
|
+
type: "object",
|
|
144
|
+
properties: {
|
|
145
|
+
id: { type: "integer" },
|
|
146
|
+
name: { type: "string" },
|
|
147
|
+
description: { type: "string" },
|
|
148
|
+
type: { type: "string", enum: ["pre", "post"] },
|
|
149
|
+
xanoscript: { type: "string" },
|
|
150
|
+
created_at: { type: "string", format: "date-time" },
|
|
151
|
+
updated_at: { type: "string", format: "date-time" }
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
related_topics: ["api", "apigroup", "authentication"]
|
|
156
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export const realtimeDoc = {
|
|
2
|
+
topic: "realtime",
|
|
3
|
+
title: "Realtime Channel Management",
|
|
4
|
+
description: `Realtime channels enable WebSocket-based push notifications and live updates to connected clients.
|
|
5
|
+
|
|
6
|
+
## Key Concepts
|
|
7
|
+
- Channels are WebSocket endpoints for real-time communication
|
|
8
|
+
- Clients subscribe to channels to receive updates
|
|
9
|
+
- Server can publish messages to channels
|
|
10
|
+
- Triggers can respond to channel events
|
|
11
|
+
- Useful for chat, notifications, live updates
|
|
12
|
+
|
|
13
|
+
## Common Use Cases
|
|
14
|
+
- Live chat applications
|
|
15
|
+
- Real-time notifications
|
|
16
|
+
- Live dashboards
|
|
17
|
+
- Collaborative editing
|
|
18
|
+
- Push updates to mobile apps`,
|
|
19
|
+
ai_hints: `- Create channels for different message types (chat, notifications, etc.)
|
|
20
|
+
- Use triggers to respond to channel events (subscribe, message, etc.)
|
|
21
|
+
- Channels require authenticated connections for security
|
|
22
|
+
- Consider rate limiting for high-traffic channels
|
|
23
|
+
- Test with WebSocket clients before production`,
|
|
24
|
+
endpoints: [
|
|
25
|
+
{
|
|
26
|
+
method: "GET",
|
|
27
|
+
path: "/workspace/{workspace_id}/realtime/channel",
|
|
28
|
+
tool_name: "listRealtimeChannels",
|
|
29
|
+
description: "List all realtime channels in a workspace.",
|
|
30
|
+
parameters: [
|
|
31
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
32
|
+
{ name: "page", type: "integer", default: 1, description: "Page number" },
|
|
33
|
+
{ name: "per_page", type: "integer", default: 50, description: "Items per page" },
|
|
34
|
+
{ name: "search", type: "string", description: "Search by channel name" }
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
method: "GET",
|
|
39
|
+
path: "/workspace/{workspace_id}/realtime/channel/{channel_id}",
|
|
40
|
+
tool_name: "getRealtimeChannel",
|
|
41
|
+
description: "Get details of a specific realtime channel.",
|
|
42
|
+
parameters: [
|
|
43
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
44
|
+
{ name: "channel_id", type: "integer", required: true, in: "path", description: "Channel ID" }
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
method: "POST",
|
|
49
|
+
path: "/workspace/{workspace_id}/realtime/channel",
|
|
50
|
+
tool_name: "createRealtimeChannel",
|
|
51
|
+
description: "Create a new realtime channel.",
|
|
52
|
+
parameters: [
|
|
53
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" }
|
|
54
|
+
],
|
|
55
|
+
request_body: {
|
|
56
|
+
type: "application/json",
|
|
57
|
+
properties: {
|
|
58
|
+
name: { type: "string", description: "Channel name", required: true },
|
|
59
|
+
description: { type: "string", description: "Channel description" }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
example: {
|
|
63
|
+
method: "POST",
|
|
64
|
+
path: "/workspace/1/realtime/channel",
|
|
65
|
+
body: {
|
|
66
|
+
name: "notifications",
|
|
67
|
+
description: "User notification channel"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
method: "PUT",
|
|
73
|
+
path: "/workspace/{workspace_id}/realtime/channel/{channel_id}",
|
|
74
|
+
tool_name: "updateRealtimeChannel",
|
|
75
|
+
description: "Update an existing realtime channel.",
|
|
76
|
+
parameters: [
|
|
77
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
78
|
+
{ name: "channel_id", type: "integer", required: true, in: "path", description: "Channel ID" }
|
|
79
|
+
],
|
|
80
|
+
request_body: {
|
|
81
|
+
type: "application/json",
|
|
82
|
+
properties: {
|
|
83
|
+
name: { type: "string", description: "Channel name" },
|
|
84
|
+
description: { type: "string", description: "Channel description" }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
method: "DELETE",
|
|
90
|
+
path: "/workspace/{workspace_id}/realtime/channel/{channel_id}",
|
|
91
|
+
tool_name: "deleteRealtimeChannel",
|
|
92
|
+
description: "Delete a realtime channel.",
|
|
93
|
+
parameters: [
|
|
94
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
95
|
+
{ name: "channel_id", type: "integer", required: true, in: "path", description: "Channel ID" }
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
schemas: {
|
|
100
|
+
RealtimeChannel: {
|
|
101
|
+
type: "object",
|
|
102
|
+
properties: {
|
|
103
|
+
id: { type: "integer" },
|
|
104
|
+
name: { type: "string" },
|
|
105
|
+
description: { type: "string" },
|
|
106
|
+
created_at: { type: "string", format: "date-time" },
|
|
107
|
+
updated_at: { type: "string", format: "date-time" }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
related_topics: ["api", "function"]
|
|
112
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export const startDoc = {
|
|
2
|
+
topic: "start",
|
|
3
|
+
title: "Xano Meta API - Getting Started",
|
|
4
|
+
description: `The Xano Meta API provides programmatic access to manage your Xano instance. Use it to create, modify, and manage workspaces, databases, APIs, functions, scheduled tasks, AI agents, and more.
|
|
5
|
+
|
|
6
|
+
## Base URL
|
|
7
|
+
\`\`\`
|
|
8
|
+
https://<your-instance-subdomain>.xano.io/api:meta/<endpoint>
|
|
9
|
+
\`\`\`
|
|
10
|
+
|
|
11
|
+
**Example:** If your Xano instance is \`https://x8ki-letl-twmt.n7.xano.io\`, the full URL to list workspaces would be:
|
|
12
|
+
\`\`\`
|
|
13
|
+
https://x8ki-letl-twmt.n7.xano.io/api:meta/workspace
|
|
14
|
+
\`\`\`
|
|
15
|
+
|
|
16
|
+
Your instance URL can be found in the Xano dashboard URL or in your API endpoint URLs.
|
|
17
|
+
|
|
18
|
+
## Authentication
|
|
19
|
+
Include your Access Token in the Authorization header:
|
|
20
|
+
\`\`\`
|
|
21
|
+
Authorization: Bearer <your-access-token>
|
|
22
|
+
\`\`\`
|
|
23
|
+
|
|
24
|
+
Access tokens are created in the Xano dashboard under Settings > Access Tokens.
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
1. **Get your workspaces:** \`GET /workspace\`
|
|
28
|
+
2. **List tables in a workspace:** \`GET /workspace/{id}/table\`
|
|
29
|
+
3. **Create an API endpoint:** \`POST /workspace/{id}/apigroup/{id}/api\`
|
|
30
|
+
|
|
31
|
+
## Resource Hierarchy
|
|
32
|
+
\`\`\`
|
|
33
|
+
workspace/
|
|
34
|
+
├── apigroup/ # API groups (REST endpoint collections)
|
|
35
|
+
│ └── api/ # Individual endpoints
|
|
36
|
+
├── table/ # Database tables
|
|
37
|
+
│ ├── schema/ # Table schema definitions
|
|
38
|
+
│ ├── index/ # Database indexes
|
|
39
|
+
│ └── trigger/ # Table triggers
|
|
40
|
+
├── function/ # Reusable functions
|
|
41
|
+
├── task/ # Scheduled tasks
|
|
42
|
+
├── agent/ # AI agents
|
|
43
|
+
│ └── trigger/ # Agent triggers
|
|
44
|
+
├── tool/ # Agent tools
|
|
45
|
+
├── mcp_server/ # MCP servers
|
|
46
|
+
│ └── trigger/ # MCP triggers
|
|
47
|
+
├── middleware/ # Request interceptors
|
|
48
|
+
├── realtime/ # WebSocket channels
|
|
49
|
+
│ └── trigger/ # Realtime triggers
|
|
50
|
+
├── branch/ # Environment branches
|
|
51
|
+
└── file/ # File storage
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
## Common Parameters
|
|
55
|
+
Most list endpoints support:
|
|
56
|
+
- \`page\`: Page number (default: 1)
|
|
57
|
+
- \`per_page\`: Items per page (default: 50, max: 10000)
|
|
58
|
+
- \`search\`: Search by name
|
|
59
|
+
- \`sort\`: Sort field (usually: id, name, created_at)
|
|
60
|
+
- \`order\`: Sort direction (asc, desc)
|
|
61
|
+
- \`branch\`: Filter by branch name
|
|
62
|
+
|
|
63
|
+
## XanoScript Integration
|
|
64
|
+
Many endpoints accept XanoScript code for logic definition:
|
|
65
|
+
- Use \`include_xanoscript=true\` to get code in responses
|
|
66
|
+
- POST/PUT bodies can include XanoScript directly
|
|
67
|
+
- Use \`/convert/fromXS\` and \`/convert/toXS\` for format conversion`,
|
|
68
|
+
ai_hints: `- Start by calling \`GET /workspace\` to get workspace IDs
|
|
69
|
+
- Use \`GET /workspace/{id}/context\` to get a full workspace map for AI understanding
|
|
70
|
+
- Always check existing resources before creating new ones
|
|
71
|
+
- Use \`include_xanoscript=true\` to see implementation details
|
|
72
|
+
- Draft/publish workflow: changes are drafts until published`,
|
|
73
|
+
related_topics: ["authentication", "workspace", "workflows"],
|
|
74
|
+
examples: [
|
|
75
|
+
{
|
|
76
|
+
title: "List all workspaces",
|
|
77
|
+
description: "Get a list of all accessible workspaces",
|
|
78
|
+
request: {
|
|
79
|
+
method: "GET",
|
|
80
|
+
path: "/workspace",
|
|
81
|
+
headers: { "Authorization": "Bearer <token>" }
|
|
82
|
+
},
|
|
83
|
+
response: {
|
|
84
|
+
curPage: 1,
|
|
85
|
+
nextPage: null,
|
|
86
|
+
prevPage: null,
|
|
87
|
+
items: [
|
|
88
|
+
{ id: 1, name: "My App", description: "Production workspace" }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: "Get workspace context for AI",
|
|
94
|
+
description: "Generate complete workspace context for AI agents",
|
|
95
|
+
request: {
|
|
96
|
+
method: "GET",
|
|
97
|
+
path: "/workspace/1/context?format=json",
|
|
98
|
+
headers: { "Authorization": "Bearer <token>" }
|
|
99
|
+
},
|
|
100
|
+
response: {
|
|
101
|
+
tables: ["users", "posts", "comments"],
|
|
102
|
+
api_groups: [{ name: "public", endpoints: 12 }],
|
|
103
|
+
functions: ["auth_check", "send_email"]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
export const tableDoc = {
|
|
2
|
+
topic: "table",
|
|
3
|
+
title: "Database Table Management",
|
|
4
|
+
description: `Tables are the database layer in Xano. Each table has a schema (fields), indexes, and optional triggers.
|
|
5
|
+
|
|
6
|
+
## Key Concepts
|
|
7
|
+
- Tables store structured data with typed fields
|
|
8
|
+
- Schemas define field types, validation, and defaults
|
|
9
|
+
- Indexes improve query performance
|
|
10
|
+
- Triggers run automatically on data changes
|
|
11
|
+
- Tables can reference other tables (foreign keys)
|
|
12
|
+
|
|
13
|
+
## Field Types
|
|
14
|
+
- **Primitives:** int, text, bool, decimal, email, password
|
|
15
|
+
- **Temporal:** timestamp, date
|
|
16
|
+
- **Structured:** json, object
|
|
17
|
+
- **Files:** blob (with subtypes: image, video, audio, attachment)
|
|
18
|
+
- **References:** tableref, tablerefuuid (foreign keys)
|
|
19
|
+
- **Special:** enum, vector, geo_* (point, polygon, etc.)`,
|
|
20
|
+
ai_hints: `- Always check existing schema before adding fields
|
|
21
|
+
- Use \`tableref\` type for foreign keys to other tables
|
|
22
|
+
- Consider indexes for frequently queried fields
|
|
23
|
+
- Triggers run automatically - be careful with side effects
|
|
24
|
+
- Use \`include_xanoscript=true\` to see full table definition`,
|
|
25
|
+
endpoints: [
|
|
26
|
+
{
|
|
27
|
+
method: "GET",
|
|
28
|
+
path: "/workspace/{workspace_id}/table",
|
|
29
|
+
tool_name: "listTables",
|
|
30
|
+
description: "List all database tables in a workspace.",
|
|
31
|
+
parameters: [
|
|
32
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
33
|
+
{ name: "page", type: "integer", default: 1, description: "Page number" },
|
|
34
|
+
{ name: "per_page", type: "integer", default: 50, description: "Items per page" },
|
|
35
|
+
{ name: "search", type: "string", description: "Search by table name" },
|
|
36
|
+
{ name: "sort", type: "string", enum: ["id", "name", "created_at"], default: "created_at", description: "Sort field" },
|
|
37
|
+
{ name: "order", type: "string", enum: ["asc", "desc"], default: "desc", description: "Sort direction" },
|
|
38
|
+
{ name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript schema definition" },
|
|
39
|
+
{ name: "branch", type: "string", description: "Filter by branch name" }
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
method: "GET",
|
|
44
|
+
path: "/workspace/{workspace_id}/table/{table_id}",
|
|
45
|
+
tool_name: "getTable",
|
|
46
|
+
description: "Get details of a specific table including schema.",
|
|
47
|
+
parameters: [
|
|
48
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
49
|
+
{ name: "table_id", type: "integer", required: true, in: "path", description: "Table ID" },
|
|
50
|
+
{ name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript definition" }
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
method: "POST",
|
|
55
|
+
path: "/workspace/{workspace_id}/table",
|
|
56
|
+
tool_name: "createTable",
|
|
57
|
+
description: "Create a new database table with optional schema.",
|
|
58
|
+
parameters: [
|
|
59
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" }
|
|
60
|
+
],
|
|
61
|
+
request_body: {
|
|
62
|
+
type: "application/json",
|
|
63
|
+
properties: {
|
|
64
|
+
name: { type: "string", description: "Table name", required: true },
|
|
65
|
+
description: { type: "string", description: "Table description" },
|
|
66
|
+
xanoscript: { type: "string", description: "XanoScript table definition with schema" }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
example: {
|
|
70
|
+
method: "POST",
|
|
71
|
+
path: "/workspace/1/table",
|
|
72
|
+
body: {
|
|
73
|
+
name: "users",
|
|
74
|
+
xanoscript: `table users {
|
|
75
|
+
id int [pk, auto]
|
|
76
|
+
email text [unique]
|
|
77
|
+
name text
|
|
78
|
+
created_at timestamp [default:now]
|
|
79
|
+
}`
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
method: "PUT",
|
|
85
|
+
path: "/workspace/{workspace_id}/table/{table_id}",
|
|
86
|
+
tool_name: "updateTable",
|
|
87
|
+
description: "Update table definition and schema.",
|
|
88
|
+
parameters: [
|
|
89
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
90
|
+
{ name: "table_id", type: "integer", required: true, in: "path", description: "Table ID" }
|
|
91
|
+
],
|
|
92
|
+
request_body: {
|
|
93
|
+
type: "application/json",
|
|
94
|
+
properties: {
|
|
95
|
+
name: { type: "string", description: "Table name" },
|
|
96
|
+
description: { type: "string", description: "Table description" },
|
|
97
|
+
xanoscript: { type: "string", description: "Updated XanoScript definition" }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
method: "DELETE",
|
|
103
|
+
path: "/workspace/{workspace_id}/table/{table_id}",
|
|
104
|
+
tool_name: "deleteTable",
|
|
105
|
+
description: "Delete a table and all its data. This action is irreversible.",
|
|
106
|
+
parameters: [
|
|
107
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
108
|
+
{ name: "table_id", type: "integer", required: true, in: "path", description: "Table ID" }
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
method: "POST",
|
|
113
|
+
path: "/workspace/{workspace_id}/table/{table_id}/schema",
|
|
114
|
+
tool_name: "addTableField",
|
|
115
|
+
description: "Add a new field to the table schema.",
|
|
116
|
+
parameters: [
|
|
117
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
118
|
+
{ name: "table_id", type: "integer", required: true, in: "path", description: "Table ID" }
|
|
119
|
+
],
|
|
120
|
+
request_body: {
|
|
121
|
+
type: "application/json",
|
|
122
|
+
properties: {
|
|
123
|
+
name: { type: "string", description: "Field name", required: true },
|
|
124
|
+
type: { type: "string", description: "Field type (int, text, bool, etc.)", required: true },
|
|
125
|
+
nullable: { type: "boolean", description: "Allow null values" },
|
|
126
|
+
default: { type: "any", description: "Default value" }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
method: "POST",
|
|
132
|
+
path: "/workspace/{workspace_id}/table/{table_id}/index",
|
|
133
|
+
tool_name: "createTableIndex",
|
|
134
|
+
description: "Create an index on table fields for query performance.",
|
|
135
|
+
parameters: [
|
|
136
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
137
|
+
{ name: "table_id", type: "integer", required: true, in: "path", description: "Table ID" }
|
|
138
|
+
],
|
|
139
|
+
request_body: {
|
|
140
|
+
type: "application/json",
|
|
141
|
+
properties: {
|
|
142
|
+
name: { type: "string", description: "Index name", required: true },
|
|
143
|
+
type: { type: "string", description: "Index type: primary, unique, btree, search, spatial, vector", required: true },
|
|
144
|
+
fields: { type: "array", description: "Fields to index", required: true }
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
method: "GET",
|
|
150
|
+
path: "/workspace/{workspace_id}/table/{table_id}/content",
|
|
151
|
+
tool_name: "getTableContent",
|
|
152
|
+
description: "Get table content/data (paginated).",
|
|
153
|
+
parameters: [
|
|
154
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
155
|
+
{ name: "table_id", type: "integer", required: true, in: "path", description: "Table ID" },
|
|
156
|
+
{ name: "page", type: "integer", default: 1, description: "Page number" },
|
|
157
|
+
{ name: "per_page", type: "integer", default: 50, description: "Items per page" }
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
schemas: {
|
|
162
|
+
Table: {
|
|
163
|
+
type: "object",
|
|
164
|
+
properties: {
|
|
165
|
+
id: { type: "integer" },
|
|
166
|
+
name: { type: "string" },
|
|
167
|
+
description: { type: "string" },
|
|
168
|
+
schema: {
|
|
169
|
+
type: "array",
|
|
170
|
+
items: {
|
|
171
|
+
type: "object",
|
|
172
|
+
properties: {
|
|
173
|
+
name: { type: "string" },
|
|
174
|
+
type: { type: "string" },
|
|
175
|
+
nullable: { type: "boolean" },
|
|
176
|
+
default: { type: "any" }
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
indexes: { type: "array" },
|
|
181
|
+
created_at: { type: "string", format: "date-time" },
|
|
182
|
+
updated_at: { type: "string", format: "date-time" }
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
FieldTypes: {
|
|
186
|
+
primitives: ["int", "text", "bool", "decimal", "email", "password"],
|
|
187
|
+
temporal: ["timestamp", "date"],
|
|
188
|
+
structured: ["json", "object"],
|
|
189
|
+
files: ["blob", "image", "video", "audio", "attachment"],
|
|
190
|
+
references: ["tableref", "tablerefuuid"],
|
|
191
|
+
special: ["enum", "vector", "geo_point", "geo_polygon", "geo_linestring"]
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
related_topics: ["function", "api", "workflows"]
|
|
195
|
+
};
|