@xano/developer-mcp 1.0.41 → 1.0.42
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 +47 -84
- package/dist/cli_docs/index.js +7 -2
- package/dist/lib.d.ts +1 -3
- package/dist/lib.js +1 -4
- package/dist/meta_api_docs/format.d.ts +0 -4
- package/dist/meta_api_docs/format.js +0 -15
- package/dist/meta_api_docs/format.test.js +7 -9
- package/dist/meta_api_docs/index.js +10 -3
- package/dist/tools/index.d.ts +3 -5
- package/dist/tools/index.js +2 -9
- package/dist/tools/validate_xanoscript.js +10 -5
- package/dist/tools/xanoscript_docs.js +11 -5
- package/package.json +1 -1
- package/dist/run_api_docs/format.d.ts +0 -6
- package/dist/run_api_docs/format.js +0 -8
- package/dist/run_api_docs/format.test.d.ts +0 -1
- package/dist/run_api_docs/format.test.js +0 -86
- package/dist/run_api_docs/index.d.ts +0 -52
- package/dist/run_api_docs/index.js +0 -90
- package/dist/run_api_docs/index.test.d.ts +0 -1
- package/dist/run_api_docs/index.test.js +0 -127
- package/dist/run_api_docs/topics/data.d.ts +0 -2
- package/dist/run_api_docs/topics/data.js +0 -104
- package/dist/run_api_docs/topics/history.d.ts +0 -2
- package/dist/run_api_docs/topics/history.js +0 -93
- package/dist/run_api_docs/topics/run.d.ts +0 -2
- package/dist/run_api_docs/topics/run.js +0 -110
- package/dist/run_api_docs/topics/session.d.ts +0 -2
- package/dist/run_api_docs/topics/session.js +0 -166
- package/dist/run_api_docs/topics/start.d.ts +0 -2
- package/dist/run_api_docs/topics/start.js +0 -97
- package/dist/run_api_docs/topics/workflows.d.ts +0 -2
- package/dist/run_api_docs/topics/workflows.js +0 -140
- package/dist/tools/run_api_docs.d.ts +0 -46
- package/dist/tools/run_api_docs.js +0 -69
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
export const runDoc = {
|
|
2
|
-
topic: "run",
|
|
3
|
-
title: "Run Execution",
|
|
4
|
-
description: `Endpoints for executing XanoScript runs. Runs are executable XanoScript documents that can be jobs (one-time execution) or services (long-running processes).
|
|
5
|
-
|
|
6
|
-
## Run Types
|
|
7
|
-
- **Job**: Executes once and terminates. Use for data processing, migrations, one-time tasks.
|
|
8
|
-
- **Service**: Runs persistently in a tenant. Use for APIs, webhooks, background workers.
|
|
9
|
-
|
|
10
|
-
## Execution Flow
|
|
11
|
-
1. Submit XanoScript document via \`/run/exec\`
|
|
12
|
-
2. System creates a session to track execution
|
|
13
|
-
3. Session progresses through states: pending → processing → running → complete/error
|
|
14
|
-
4. Retrieve results from the session
|
|
15
|
-
|
|
16
|
-
## Templates
|
|
17
|
-
The \`template\` parameter controls resource allocation:
|
|
18
|
-
- \`small\`: Default, suitable for most workloads
|
|
19
|
-
- Additional templates may be available for larger workloads`,
|
|
20
|
-
ai_hints: `- Include complete XanoScript in the 'doc' parameter
|
|
21
|
-
- Use 'args' to pass dynamic data to runs (available as $args in XanoScript)
|
|
22
|
-
- Use 'env' to override environment variables for this execution
|
|
23
|
-
- Template affects resource allocation - use "small" for typical workloads
|
|
24
|
-
- Re-executing a run reuses its stored configuration with optional overrides
|
|
25
|
-
- Check the session state after execution to verify success`,
|
|
26
|
-
endpoints: [
|
|
27
|
-
{
|
|
28
|
-
method: "POST",
|
|
29
|
-
path: "/project/{project_id}/run/exec",
|
|
30
|
-
tool_name: "run",
|
|
31
|
-
description: "Execute a new XanoScript run. Creates a session to track execution and returns the result.",
|
|
32
|
-
parameters: [
|
|
33
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" }
|
|
34
|
-
],
|
|
35
|
-
request_body: {
|
|
36
|
-
type: "application/json",
|
|
37
|
-
properties: {
|
|
38
|
-
doc: { type: "text", required: true, description: "XanoScript document content" },
|
|
39
|
-
args: { type: "json", description: "Arguments passed to the job (default: {})" },
|
|
40
|
-
env: { type: "json", description: "Environment variable overrides (default: {})" },
|
|
41
|
-
template: { type: "text", description: "Execution template (default: 'small')" },
|
|
42
|
-
logs: { type: "json[]", description: "Execution logs array (default: [])" }
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
example: {
|
|
46
|
-
method: "POST",
|
|
47
|
-
path: "/project/abc123-uuid/run/exec",
|
|
48
|
-
body: {
|
|
49
|
-
doc: "job process_data {\n input { json items }\n response = $input.items.map(i => i.value * 2)\n}",
|
|
50
|
-
args: { items: [{ value: 1 }, { value: 2 }, { value: 3 }] },
|
|
51
|
-
template: "small"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
method: "POST",
|
|
57
|
-
path: "/project/{project_id}/run/{run_id}/exec",
|
|
58
|
-
description: "Re-execute an existing run by its ID. Uses the stored run configuration with optional argument and environment overrides.",
|
|
59
|
-
parameters: [
|
|
60
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
61
|
-
{ name: "run_id", type: "uuid", required: true, in: "path", description: "Run UUID to re-execute" }
|
|
62
|
-
],
|
|
63
|
-
request_body: {
|
|
64
|
-
type: "application/json",
|
|
65
|
-
properties: {
|
|
66
|
-
args: { type: "json", description: "Override arguments (default: {})" },
|
|
67
|
-
env: { type: "json", description: "Override environment variables (default: {})" },
|
|
68
|
-
template: { type: "text", description: "Execution template (default: 'small')" },
|
|
69
|
-
logs: { type: "json[]", description: "Execution logs array (default: [])" }
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
example: {
|
|
73
|
-
method: "POST",
|
|
74
|
-
path: "/project/abc123-uuid/run/run456-uuid/exec",
|
|
75
|
-
body: {
|
|
76
|
-
args: { updated_value: 100 },
|
|
77
|
-
template: "small"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
schemas: {
|
|
83
|
-
Run: {
|
|
84
|
-
type: "object",
|
|
85
|
-
properties: {
|
|
86
|
-
id: { type: "uuid", description: "Unique run identifier" },
|
|
87
|
-
name: { type: "text", description: "Run name" },
|
|
88
|
-
type: { type: "enum", enum: ["job", "service"], description: "Run type" },
|
|
89
|
-
doc: { type: "text", description: "XanoScript document content" },
|
|
90
|
-
args: { type: "json", description: "Stored arguments" },
|
|
91
|
-
project_id: { type: "uuid", description: "Associated project" },
|
|
92
|
-
user_id: { type: "integer", description: "Owner user ID" },
|
|
93
|
-
sig: { type: "text", description: "Document signature/hash" },
|
|
94
|
-
created_at: { type: "timestamp", description: "Creation time" },
|
|
95
|
-
updated_at: { type: "timestamp", description: "Last update time" }
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
ExecutionResult: {
|
|
99
|
-
type: "object",
|
|
100
|
-
properties: {
|
|
101
|
-
session_id: { type: "uuid", description: "Created session ID" },
|
|
102
|
-
state: { type: "enum", enum: ["pending", "processing", "running", "error", "complete"] },
|
|
103
|
-
response: { type: "any", description: "Execution result" },
|
|
104
|
-
error_msg: { type: "text", description: "Error message if failed" },
|
|
105
|
-
logs: { type: "json[]", description: "Execution logs" }
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
related_topics: ["session", "history", "workflows"]
|
|
110
|
-
};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
export const sessionDoc = {
|
|
2
|
-
topic: "session",
|
|
3
|
-
title: "Session Management",
|
|
4
|
-
description: `Sessions are active runtime execution contexts with isolated state. Each run execution creates a session that tracks the execution lifecycle, timing metrics, and results.
|
|
5
|
-
|
|
6
|
-
## Session States
|
|
7
|
-
- \`pending\`: Awaiting execution
|
|
8
|
-
- \`processing\`: Setting up execution environment
|
|
9
|
-
- \`running\`: Active execution in progress
|
|
10
|
-
- \`error\`: Execution failed
|
|
11
|
-
- \`complete\`: Execution finished successfully
|
|
12
|
-
|
|
13
|
-
## Access Levels
|
|
14
|
-
- \`private\`: Requires authentication and project ownership
|
|
15
|
-
- \`public\`: Accessible without authentication
|
|
16
|
-
|
|
17
|
-
## Session Lifecycle
|
|
18
|
-
1. **Creation**: Session created when a run is executed
|
|
19
|
-
2. **Execution**: Session progresses through states
|
|
20
|
-
3. **Hibernation**: Long-running services may hibernate after timeout
|
|
21
|
-
4. **Termination**: Sessions can be stopped manually or auto-cleanup
|
|
22
|
-
|
|
23
|
-
## Timing Metrics
|
|
24
|
-
Sessions track detailed timing information:
|
|
25
|
-
- \`boot_time\`: Environment setup time
|
|
26
|
-
- \`pre_time\`: Pre-execution processing
|
|
27
|
-
- \`main_time\`: Main execution duration
|
|
28
|
-
- \`post_time\`: Post-execution cleanup
|
|
29
|
-
- \`total_time\`: Complete execution time`,
|
|
30
|
-
ai_hints: `- Check session state before performing operations
|
|
31
|
-
- Only "service" type sessions can be re-executed with new documents
|
|
32
|
-
- Public sessions are accessible without auth - use for sharing results
|
|
33
|
-
- Sessions auto-hibernate after project timeout (default: 1 hour)
|
|
34
|
-
- Use /stop endpoint to gracefully terminate running sessions
|
|
35
|
-
- Cannot stop sessions already in "error" or "complete" state`,
|
|
36
|
-
endpoints: [
|
|
37
|
-
{
|
|
38
|
-
method: "GET",
|
|
39
|
-
path: "/project/{project_id}/run/session",
|
|
40
|
-
tool_name: "getProjectSessions",
|
|
41
|
-
description: "List all active sessions for a project with pagination.",
|
|
42
|
-
parameters: [
|
|
43
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
44
|
-
{ name: "page", type: "integer", default: 1, description: "Page number (min: 1)" }
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
method: "GET",
|
|
49
|
-
path: "/project/{project_id}/run/{run_id}/session",
|
|
50
|
-
tool_name: "getRunSessions",
|
|
51
|
-
description: "List all sessions for a specific run.",
|
|
52
|
-
parameters: [
|
|
53
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
54
|
-
{ name: "run_id", type: "uuid", required: true, in: "path", description: "Run UUID" },
|
|
55
|
-
{ name: "page", type: "integer", default: 1, description: "Page number (min: 1)" }
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
method: "GET",
|
|
60
|
-
path: "/session/{session_id}",
|
|
61
|
-
tool_name: "getSession",
|
|
62
|
-
description: "Get detailed information about a session including status, run config, and timing metrics. Public sessions don't require authentication.",
|
|
63
|
-
parameters: [
|
|
64
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
method: "POST",
|
|
69
|
-
path: "/session/{session_id}/access",
|
|
70
|
-
tool_name: "setSessionAccess",
|
|
71
|
-
description: "Update the access level of a session (public or private).",
|
|
72
|
-
parameters: [
|
|
73
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
74
|
-
],
|
|
75
|
-
request_body: {
|
|
76
|
-
type: "application/json",
|
|
77
|
-
properties: {
|
|
78
|
-
access: { type: "enum", required: true, description: "Access level: 'public' or 'private'" }
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
example: {
|
|
82
|
-
method: "POST",
|
|
83
|
-
path: "/session/session-uuid/access",
|
|
84
|
-
body: { access: "public" }
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
method: "POST",
|
|
89
|
-
path: "/session/{session_id}/exec",
|
|
90
|
-
description: "Re-execute on an existing service session with a new XanoScript document. Reuses the session's resources (tenant). Only works on 'service' type sessions with a valid tenant.",
|
|
91
|
-
parameters: [
|
|
92
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
93
|
-
],
|
|
94
|
-
request_body: {
|
|
95
|
-
type: "application/json",
|
|
96
|
-
properties: {
|
|
97
|
-
doc: { type: "text", required: true, description: "New XanoScript document" },
|
|
98
|
-
args: { type: "json", description: "Arguments (default: {})" },
|
|
99
|
-
env: { type: "json", description: "Environment overrides (default: {})" }
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
example: {
|
|
103
|
-
method: "POST",
|
|
104
|
-
path: "/session/session-uuid/exec",
|
|
105
|
-
body: {
|
|
106
|
-
doc: "job updated_logic {\n response = \"New execution on existing session\"\n}",
|
|
107
|
-
args: {}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
method: "PATCH",
|
|
113
|
-
path: "/session/{session_id}",
|
|
114
|
-
tool_name: "updateSessionRun",
|
|
115
|
-
description: "Update the run name associated with a session.",
|
|
116
|
-
parameters: [
|
|
117
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
118
|
-
],
|
|
119
|
-
request_body: {
|
|
120
|
-
type: "application/json",
|
|
121
|
-
properties: {
|
|
122
|
-
name: { type: "text", required: true, description: "New run name (min 1 character)" }
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
method: "POST",
|
|
128
|
-
path: "/project/{project_id}/run/{run_id}/session/{session_id}/stop",
|
|
129
|
-
tool_name: "stopSession",
|
|
130
|
-
description: "Stop and tear down a running session. Creates a backup before deletion. Cannot stop sessions already in 'error' or 'complete' state.",
|
|
131
|
-
parameters: [
|
|
132
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
133
|
-
{ name: "run_id", type: "uuid", required: true, in: "path", description: "Run UUID" },
|
|
134
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
],
|
|
138
|
-
schemas: {
|
|
139
|
-
Session: {
|
|
140
|
-
type: "object",
|
|
141
|
-
properties: {
|
|
142
|
-
id: { type: "uuid", description: "Session identifier" },
|
|
143
|
-
run_id: { type: "uuid", description: "Associated run" },
|
|
144
|
-
state: { type: "enum", enum: ["pending", "processing", "running", "error", "complete"], description: "Current state" },
|
|
145
|
-
access: { type: "enum", enum: ["private", "public"], description: "Access level" },
|
|
146
|
-
doc: { type: "text", description: "Executed XanoScript" },
|
|
147
|
-
version: { type: "integer", description: "Document version" },
|
|
148
|
-
response: { type: "json", description: "Execution response" },
|
|
149
|
-
error_msg: { type: "text", description: "Error message if failed" },
|
|
150
|
-
logs: { type: "json[]", description: "Execution logs" },
|
|
151
|
-
label: { type: "text", description: "Session label" },
|
|
152
|
-
tenant_id: { type: "integer", description: "Runtime tenant reference" },
|
|
153
|
-
hibernate_at: { type: "timestamp", description: "Hibernation timestamp" },
|
|
154
|
-
pre_time: { type: "decimal", description: "Pre-execution time" },
|
|
155
|
-
post_time: { type: "decimal", description: "Post-execution time" },
|
|
156
|
-
main_time: { type: "decimal", description: "Main execution time" },
|
|
157
|
-
boot_time: { type: "decimal", description: "Boot time" },
|
|
158
|
-
total_time: { type: "decimal", description: "Total execution time" },
|
|
159
|
-
backup: { type: "object", description: "Backup info with resource and size" },
|
|
160
|
-
created_at: { type: "timestamp", description: "Creation time" },
|
|
161
|
-
updated_at: { type: "timestamp", description: "Last update time" }
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
related_topics: ["run", "data", "workflows"]
|
|
166
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
export const startDoc = {
|
|
2
|
-
topic: "start",
|
|
3
|
-
title: "Xano Run API - Getting Started",
|
|
4
|
-
description: `The Xano Run API provides programmatic access to execute XanoScript, manage runtime sessions, and work with execution environments. Use it to run scripts, manage long-running services, and retrieve execution history.
|
|
5
|
-
|
|
6
|
-
## Base URL
|
|
7
|
-
\`\`\`
|
|
8
|
-
https://app.dev.xano.com/api:run/<endpoint>
|
|
9
|
-
\`\`\`
|
|
10
|
-
|
|
11
|
-
**Important:** This is a fixed URL - NOT your Xano instance URL. All Run API requests go to this central endpoint.
|
|
12
|
-
|
|
13
|
-
## Authentication
|
|
14
|
-
Include your Access Token in the Authorization header:
|
|
15
|
-
\`\`\`
|
|
16
|
-
Authorization: Bearer <your-access-token>
|
|
17
|
-
\`\`\`
|
|
18
|
-
|
|
19
|
-
Access tokens are created in the Xano dashboard under Settings > Access Tokens.
|
|
20
|
-
|
|
21
|
-
## Key Concepts
|
|
22
|
-
|
|
23
|
-
### Run Types
|
|
24
|
-
- **Job**: One-time execution that runs to completion and terminates
|
|
25
|
-
- **Service**: Long-running process that persists in a tenant until stopped
|
|
26
|
-
|
|
27
|
-
### Sessions
|
|
28
|
-
Sessions are active runtime execution contexts with isolated state. Each execution creates a session that tracks:
|
|
29
|
-
- Execution state (pending, processing, running, error, complete)
|
|
30
|
-
- Timing metrics (boot_time, main_time, total_time, etc.)
|
|
31
|
-
- Response data and logs
|
|
32
|
-
- Access level (public/private)
|
|
33
|
-
|
|
34
|
-
### Resource Hierarchy
|
|
35
|
-
\`\`\`
|
|
36
|
-
project/
|
|
37
|
-
└── run/ # Stored run configurations
|
|
38
|
-
└── session/ # Active execution contexts
|
|
39
|
-
└── backup/sink # Data snapshots
|
|
40
|
-
\`\`\`
|
|
41
|
-
|
|
42
|
-
## Quick Start
|
|
43
|
-
1. **Execute a script:** \`POST /project/{project_id}/run/exec\` with your XanoScript
|
|
44
|
-
2. **Check session status:** \`GET /session/{session_id}\`
|
|
45
|
-
3. **View run history:** \`GET /project/{project_id}/run\`
|
|
46
|
-
|
|
47
|
-
## Common Parameters
|
|
48
|
-
- \`project_id\`: UUID of your project (required for most endpoints)
|
|
49
|
-
- \`run_id\`: UUID of a stored run configuration
|
|
50
|
-
- \`session_id\`: UUID of an active session
|
|
51
|
-
- \`doc\`: XanoScript document content
|
|
52
|
-
- \`args\`: JSON arguments passed to the execution
|
|
53
|
-
- \`env\`: Environment variable overrides`,
|
|
54
|
-
ai_hints: `- Use \`POST /project/{id}/run/exec\` to execute new XanoScript
|
|
55
|
-
- Sessions are created automatically from executions
|
|
56
|
-
- Use "job" type for one-time tasks, "service" for long-running processes
|
|
57
|
-
- Check session state before operations (running, error, complete)
|
|
58
|
-
- Only "service" type sessions can be re-executed with new documents
|
|
59
|
-
- Use \`GET /session/{id}/sink\` to export all data after hibernation`,
|
|
60
|
-
related_topics: ["run", "session", "workflows"],
|
|
61
|
-
examples: [
|
|
62
|
-
{
|
|
63
|
-
title: "Execute a simple XanoScript",
|
|
64
|
-
description: "Run a XanoScript job and get the result",
|
|
65
|
-
request: {
|
|
66
|
-
method: "POST",
|
|
67
|
-
path: "/project/abc123-uuid/run/exec",
|
|
68
|
-
headers: { "Authorization": "Bearer <token>" },
|
|
69
|
-
body: {
|
|
70
|
-
doc: "job hello {\n response = \"Hello, World!\"\n}",
|
|
71
|
-
args: {},
|
|
72
|
-
template: "small"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
response: {
|
|
76
|
-
session_id: "session-uuid-here",
|
|
77
|
-
state: "complete",
|
|
78
|
-
response: "Hello, World!"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
title: "Check session status",
|
|
83
|
-
description: "Get details about a running or completed session",
|
|
84
|
-
request: {
|
|
85
|
-
method: "GET",
|
|
86
|
-
path: "/session/session-uuid-here",
|
|
87
|
-
headers: { "Authorization": "Bearer <token>" }
|
|
88
|
-
},
|
|
89
|
-
response: {
|
|
90
|
-
id: "session-uuid-here",
|
|
91
|
-
state: "running",
|
|
92
|
-
access: "private",
|
|
93
|
-
created_at: "2024-01-15T10:30:00Z"
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
export const workflowsDoc = {
|
|
2
|
-
topic: "workflows",
|
|
3
|
-
title: "Common Workflows",
|
|
4
|
-
description: `Step-by-step guides for common multi-step tasks using the Xano Run API.
|
|
5
|
-
|
|
6
|
-
## Quick Reference
|
|
7
|
-
- **Execute Script**: validate doc → execute → check session
|
|
8
|
-
- **Monitor Session**: list sessions → get details → check state
|
|
9
|
-
- **Export Data**: execute service → wait for hibernate → get sink
|
|
10
|
-
- **Re-execute**: get history → re-execute with overrides`,
|
|
11
|
-
ai_hints: `- Always validate scripts with doc/info before execution
|
|
12
|
-
- Monitor session state changes for long-running services
|
|
13
|
-
- Clean up unused sessions to conserve resources
|
|
14
|
-
- Use the fixed base URL: https://app.dev.xano.com/api:run/<endpoint>
|
|
15
|
-
- Sessions auto-hibernate after project timeout
|
|
16
|
-
- Export data via /sink only after hibernation`,
|
|
17
|
-
patterns: [
|
|
18
|
-
{
|
|
19
|
-
name: "Execute New XanoScript",
|
|
20
|
-
description: "Validate, execute, and monitor a XanoScript job",
|
|
21
|
-
steps: [
|
|
22
|
-
"1. `POST /project/{project_id}/doc/info` - Validate script structure",
|
|
23
|
-
"2. `POST /project/{project_id}/run/exec` - Execute the script",
|
|
24
|
-
"3. `GET /session/{session_id}` - Check execution status",
|
|
25
|
-
"4. (if running) Poll session until state is 'complete' or 'error'"
|
|
26
|
-
],
|
|
27
|
-
example: `// 1. Validate document
|
|
28
|
-
POST https://app.dev.xano.com/api:run/project/abc123/doc/info
|
|
29
|
-
{
|
|
30
|
-
"doc": "job process_data {\\n response = db.items.query().all()\\n}"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// 2. Execute
|
|
34
|
-
POST https://app.dev.xano.com/api:run/project/abc123/run/exec
|
|
35
|
-
{
|
|
36
|
-
"doc": "job process_data {\\n response = db.items.query().all()\\n}",
|
|
37
|
-
"args": {},
|
|
38
|
-
"template": "small"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// 3. Check status
|
|
42
|
-
GET https://app.dev.xano.com/api:run/session/{returned_session_id}`
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "Run a Persistent Service",
|
|
46
|
-
description: "Start a long-running service and manage its lifecycle",
|
|
47
|
-
steps: [
|
|
48
|
-
"1. `POST /project/{project_id}/run/exec` - Start service (type: service)",
|
|
49
|
-
"2. `GET /session/{session_id}` - Verify service is running",
|
|
50
|
-
"3. `POST /session/{session_id}/access` - Optionally make public",
|
|
51
|
-
"4. `POST /session/{session_id}/exec` - Re-execute with new code if needed",
|
|
52
|
-
"5. `POST /project/{project_id}/run/{run_id}/session/{session_id}/stop` - Stop when done"
|
|
53
|
-
],
|
|
54
|
-
example: `// 1. Start service
|
|
55
|
-
POST https://app.dev.xano.com/api:run/project/abc123/run/exec
|
|
56
|
-
{
|
|
57
|
-
"doc": "service my_api {\\n endpoint GET /hello {\\n response = 'Hello!'\\n }\\n}",
|
|
58
|
-
"args": {}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// 2. Stop service when done
|
|
62
|
-
POST https://app.dev.xano.com/api:run/project/abc123/run/{run_id}/session/{session_id}/stop`
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: "Export Session Data",
|
|
66
|
-
description: "Export all data from a session after hibernation",
|
|
67
|
-
steps: [
|
|
68
|
-
"1. Execute a run (job or service)",
|
|
69
|
-
"2. Wait for session to hibernate (auto or via stop)",
|
|
70
|
-
"3. `GET /session/{session_id}/sink` - Export all data"
|
|
71
|
-
],
|
|
72
|
-
example: `// 1. After session has run and hibernated
|
|
73
|
-
GET https://app.dev.xano.com/api:run/session/{session_id}/sink
|
|
74
|
-
|
|
75
|
-
// Response includes all tables and records as JSON`
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "Re-execute with Modified Arguments",
|
|
79
|
-
description: "Run an existing script again with different inputs",
|
|
80
|
-
steps: [
|
|
81
|
-
"1. `GET /project/{project_id}/run` - Get run history",
|
|
82
|
-
"2. Find the run_id you want to re-execute",
|
|
83
|
-
"3. `POST /project/{project_id}/run/{run_id}/exec` - Re-execute with new args"
|
|
84
|
-
],
|
|
85
|
-
example: `// 1. Get history
|
|
86
|
-
GET https://app.dev.xano.com/api:run/project/abc123/run
|
|
87
|
-
|
|
88
|
-
// 2. Re-execute with different args
|
|
89
|
-
POST https://app.dev.xano.com/api:run/project/abc123/run/{run_id}/exec
|
|
90
|
-
{
|
|
91
|
-
"args": {
|
|
92
|
-
"batch_size": 100,
|
|
93
|
-
"mode": "production"
|
|
94
|
-
}
|
|
95
|
-
}`
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: "Monitor Active Sessions",
|
|
99
|
-
description: "List and monitor running sessions for a project",
|
|
100
|
-
steps: [
|
|
101
|
-
"1. `GET /project/{project_id}/run/session` - List all sessions",
|
|
102
|
-
"2. Filter by state (running, pending, etc.)",
|
|
103
|
-
"3. `GET /session/{session_id}` - Get details for specific session",
|
|
104
|
-
"4. Take action based on state (stop, re-execute, export)"
|
|
105
|
-
],
|
|
106
|
-
example: `// 1. List sessions
|
|
107
|
-
GET https://app.dev.xano.com/api:run/project/abc123/run/session?page=1
|
|
108
|
-
|
|
109
|
-
// 2. Check specific session
|
|
110
|
-
GET https://app.dev.xano.com/api:run/session/{session_id}
|
|
111
|
-
|
|
112
|
-
// 3. Stop if needed
|
|
113
|
-
POST https://app.dev.xano.com/api:run/project/abc123/run/{run_id}/session/{session_id}/stop`
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: "Debug Failed Execution",
|
|
117
|
-
description: "Investigate why a run failed",
|
|
118
|
-
steps: [
|
|
119
|
-
"1. `GET /session/{session_id}` - Check session state and error_msg",
|
|
120
|
-
"2. Review the 'logs' field for execution details",
|
|
121
|
-
"3. `POST /project/{project_id}/doc/info` - Validate the script syntax",
|
|
122
|
-
"4. Fix issues and re-execute"
|
|
123
|
-
],
|
|
124
|
-
example: `// 1. Get session details
|
|
125
|
-
GET https://app.dev.xano.com/api:run/session/{session_id}
|
|
126
|
-
|
|
127
|
-
// Response includes:
|
|
128
|
-
// - state: "error"
|
|
129
|
-
// - error_msg: "Detailed error message"
|
|
130
|
-
// - logs: [...execution logs...]
|
|
131
|
-
|
|
132
|
-
// 2. Validate fixed script
|
|
133
|
-
POST https://app.dev.xano.com/api:run/project/abc123/doc/info
|
|
134
|
-
{
|
|
135
|
-
"doc": "job fixed_script {\\n // corrected code\\n}"
|
|
136
|
-
}`
|
|
137
|
-
}
|
|
138
|
-
],
|
|
139
|
-
related_topics: ["start", "run", "session", "data"]
|
|
140
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run API Documentation Tool
|
|
3
|
-
*
|
|
4
|
-
* Retrieves documentation for Xano's Run API.
|
|
5
|
-
* Re-exports from the run_api_docs module with ToolResult support.
|
|
6
|
-
*/
|
|
7
|
-
import { runApiDocsToolDefinition, topics, getTopicNames, getTopicDescriptions } from "../run_api_docs/index.js";
|
|
8
|
-
import type { TopicDoc, DetailLevel } from "../meta_api_docs/types.js";
|
|
9
|
-
import type { ToolResult } from "./types.js";
|
|
10
|
-
export { runApiDocsToolDefinition, topics as runApiTopics, getTopicNames as getRunApiTopicNames, getTopicDescriptions as getRunApiTopicDescriptions, };
|
|
11
|
-
export type { TopicDoc, DetailLevel };
|
|
12
|
-
export interface RunApiDocsArgs {
|
|
13
|
-
topic: string;
|
|
14
|
-
detail_level?: DetailLevel;
|
|
15
|
-
include_schemas?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface RunApiDocsResult {
|
|
18
|
-
documentation: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get Xano Run API documentation.
|
|
22
|
-
*
|
|
23
|
-
* @param args - Documentation arguments
|
|
24
|
-
* @returns Documentation content
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* import { runApiDocs } from '@xano/developer-mcp';
|
|
29
|
-
*
|
|
30
|
-
* // Get overview
|
|
31
|
-
* const overview = runApiDocs({ topic: 'start' });
|
|
32
|
-
*
|
|
33
|
-
* // Get session documentation with examples
|
|
34
|
-
* const sessionDocs = runApiDocs({
|
|
35
|
-
* topic: 'session',
|
|
36
|
-
* detail_level: 'examples',
|
|
37
|
-
* include_schemas: true
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare function runApiDocs(args: RunApiDocsArgs): RunApiDocsResult;
|
|
42
|
-
/**
|
|
43
|
-
* Get Run API documentation and return a ToolResult.
|
|
44
|
-
*/
|
|
45
|
-
export declare function runApiDocsTool(args: RunApiDocsArgs): ToolResult;
|
|
46
|
-
export { runApiDocsToolDefinition as toolDefinition };
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run API Documentation Tool
|
|
3
|
-
*
|
|
4
|
-
* Retrieves documentation for Xano's Run API.
|
|
5
|
-
* Re-exports from the run_api_docs module with ToolResult support.
|
|
6
|
-
*/
|
|
7
|
-
import { handleRunApiDocs as _handleRunApiDocs, runApiDocsToolDefinition, topics, getTopicNames, getTopicDescriptions, } from "../run_api_docs/index.js";
|
|
8
|
-
// =============================================================================
|
|
9
|
-
// Re-exports
|
|
10
|
-
// =============================================================================
|
|
11
|
-
export { runApiDocsToolDefinition, topics as runApiTopics, getTopicNames as getRunApiTopicNames, getTopicDescriptions as getRunApiTopicDescriptions, };
|
|
12
|
-
// =============================================================================
|
|
13
|
-
// Standalone Tool Function
|
|
14
|
-
// =============================================================================
|
|
15
|
-
/**
|
|
16
|
-
* Get Xano Run API documentation.
|
|
17
|
-
*
|
|
18
|
-
* @param args - Documentation arguments
|
|
19
|
-
* @returns Documentation content
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* import { runApiDocs } from '@xano/developer-mcp';
|
|
24
|
-
*
|
|
25
|
-
* // Get overview
|
|
26
|
-
* const overview = runApiDocs({ topic: 'start' });
|
|
27
|
-
*
|
|
28
|
-
* // Get session documentation with examples
|
|
29
|
-
* const sessionDocs = runApiDocs({
|
|
30
|
-
* topic: 'session',
|
|
31
|
-
* detail_level: 'examples',
|
|
32
|
-
* include_schemas: true
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export function runApiDocs(args) {
|
|
37
|
-
if (!args?.topic) {
|
|
38
|
-
throw new Error("'topic' parameter is required. Use topic='start' for overview.");
|
|
39
|
-
}
|
|
40
|
-
const documentation = _handleRunApiDocs(args.topic, args.detail_level, args.include_schemas);
|
|
41
|
-
return { documentation };
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get Run API documentation and return a ToolResult.
|
|
45
|
-
*/
|
|
46
|
-
export function runApiDocsTool(args) {
|
|
47
|
-
if (!args?.topic) {
|
|
48
|
-
return {
|
|
49
|
-
success: false,
|
|
50
|
-
error: "Error: 'topic' parameter is required. Use run_api_docs with topic='start' for overview.",
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
const result = runApiDocs(args);
|
|
55
|
-
return {
|
|
56
|
-
success: true,
|
|
57
|
-
data: result.documentation,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62
|
-
return {
|
|
63
|
-
success: false,
|
|
64
|
-
error: `Error retrieving Run API documentation: ${errorMessage}`,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// Re-export tool definition for MCP
|
|
69
|
-
export { runApiDocsToolDefinition as toolDefinition };
|