@xano/developer-mcp 1.0.13 → 1.0.15
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 +8 -8
- package/dist/api_docs/format.js +5 -2
- package/dist/index.js +44 -5
- 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/package.json +1 -1
package/README.md
CHANGED
|
@@ -194,7 +194,7 @@ Get the current version of the Xano Developer MCP server.
|
|
|
194
194
|
mcp_version()
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
### 5. `
|
|
197
|
+
### 5. `meta_api_docs`
|
|
198
198
|
|
|
199
199
|
Get documentation for Xano's Meta API. Use this to understand how to programmatically manage Xano workspaces, databases, APIs, functions, agents, and more.
|
|
200
200
|
|
|
@@ -230,16 +230,16 @@ Get documentation for Xano's Meta API. Use this to understand how to programmati
|
|
|
230
230
|
**Examples:**
|
|
231
231
|
```
|
|
232
232
|
// Get overview of Meta API
|
|
233
|
-
|
|
233
|
+
meta_api_docs({ topic: "start" })
|
|
234
234
|
|
|
235
235
|
// Get detailed table documentation
|
|
236
|
-
|
|
236
|
+
meta_api_docs({ topic: "table", detail_level: "detailed" })
|
|
237
237
|
|
|
238
238
|
// Get examples without schemas (smaller context)
|
|
239
|
-
|
|
239
|
+
meta_api_docs({ topic: "api", detail_level: "examples", include_schemas: false })
|
|
240
240
|
|
|
241
241
|
// Step-by-step workflow guides
|
|
242
|
-
|
|
242
|
+
meta_api_docs({ topic: "workflows" })
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
## MCP Resources
|
|
@@ -287,7 +287,7 @@ xano-developer-mcp/
|
|
|
287
287
|
├── src/
|
|
288
288
|
│ ├── index.ts # Main MCP server implementation
|
|
289
289
|
│ ├── xanoscript.d.ts # TypeScript declarations
|
|
290
|
-
│ ├──
|
|
290
|
+
│ ├── meta_api_docs/ # Meta API documentation
|
|
291
291
|
│ │ ├── index.ts # API docs tool handler
|
|
292
292
|
│ │ ├── types.ts # Type definitions
|
|
293
293
|
│ │ ├── format.ts # Documentation formatter
|
|
@@ -327,7 +327,7 @@ Xano Developer MCP Server
|
|
|
327
327
|
│
|
|
328
328
|
├─► xanoscript_docs → Context-aware docs from /xanoscript_docs/*.md
|
|
329
329
|
│
|
|
330
|
-
├─►
|
|
330
|
+
├─► meta_api_docs → Meta API documentation with detail levels
|
|
331
331
|
│
|
|
332
332
|
├─► mcp_version → Returns server version from package.json
|
|
333
333
|
│
|
|
@@ -357,7 +357,7 @@ Compiles TypeScript to JavaScript in the `dist/` directory.
|
|
|
357
357
|
- **applyTo**: Glob patterns for context-aware matching (e.g., `apis/**/*.xs`)
|
|
358
358
|
- **description**: Human-readable description of the topic
|
|
359
359
|
|
|
360
|
-
**Meta API Documentation** (`src/
|
|
360
|
+
**Meta API Documentation** (`src/meta_api_docs/`):
|
|
361
361
|
- TypeScript modules with structured documentation
|
|
362
362
|
- Supports parameterized output (detail levels, schema inclusion)
|
|
363
363
|
- Better for AI consumption due to context efficiency
|
package/dist/api_docs/format.js
CHANGED
|
@@ -121,10 +121,13 @@ export function formatDocumentation(doc, detailLevel = "detailed", includeSchema
|
|
|
121
121
|
sections.push("## AI Usage Hints");
|
|
122
122
|
sections.push(doc.ai_hints);
|
|
123
123
|
}
|
|
124
|
-
//
|
|
125
|
-
if (doc.endpoints?.length) {
|
|
124
|
+
// Include base URL info if topic has endpoints or patterns (workflows)
|
|
125
|
+
if (doc.endpoints?.length || doc.patterns?.length) {
|
|
126
126
|
sections.push("");
|
|
127
127
|
sections.push(BASE_URL_INFO);
|
|
128
|
+
}
|
|
129
|
+
// Endpoints
|
|
130
|
+
if (doc.endpoints?.length) {
|
|
128
131
|
sections.push("## Endpoints");
|
|
129
132
|
for (const ep of doc.endpoints) {
|
|
130
133
|
sections.push("");
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,8 @@ import { dirname, join } from "path";
|
|
|
8
8
|
import { minimatch } from "minimatch";
|
|
9
9
|
import { xanoscriptParser } from "@xano/xanoscript-language-server/parser/parser.js";
|
|
10
10
|
import { getSchemeFromContent } from "@xano/xanoscript-language-server/utils.js";
|
|
11
|
-
import {
|
|
11
|
+
import { metaApiDocsToolDefinition, handleMetaApiDocs } from "./meta_api_docs/index.js";
|
|
12
|
+
import { runApiDocsToolDefinition, handleRunApiDocs } from "./run_api_docs/index.js";
|
|
12
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
14
|
const __dirname = dirname(__filename);
|
|
14
15
|
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
@@ -366,7 +367,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
366
367
|
required: [],
|
|
367
368
|
},
|
|
368
369
|
},
|
|
369
|
-
|
|
370
|
+
metaApiDocsToolDefinition,
|
|
371
|
+
runApiDocsToolDefinition,
|
|
370
372
|
],
|
|
371
373
|
};
|
|
372
374
|
});
|
|
@@ -465,21 +467,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
465
467
|
],
|
|
466
468
|
};
|
|
467
469
|
}
|
|
468
|
-
if (request.params.name === "
|
|
470
|
+
if (request.params.name === "meta_api_docs") {
|
|
469
471
|
const args = request.params.arguments;
|
|
470
472
|
if (!args?.topic) {
|
|
471
473
|
return {
|
|
472
474
|
content: [
|
|
473
475
|
{
|
|
474
476
|
type: "text",
|
|
475
|
-
text: "Error: 'topic' parameter is required. Use
|
|
477
|
+
text: "Error: 'topic' parameter is required. Use meta_api_docs with topic='start' for overview.",
|
|
476
478
|
},
|
|
477
479
|
],
|
|
478
480
|
isError: true,
|
|
479
481
|
};
|
|
480
482
|
}
|
|
481
483
|
try {
|
|
482
|
-
const documentation =
|
|
484
|
+
const documentation = handleMetaApiDocs({
|
|
483
485
|
topic: args.topic,
|
|
484
486
|
detail_level: args.detail_level,
|
|
485
487
|
include_schemas: args.include_schemas,
|
|
@@ -506,6 +508,43 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
506
508
|
};
|
|
507
509
|
}
|
|
508
510
|
}
|
|
511
|
+
if (request.params.name === "run_api_docs") {
|
|
512
|
+
const args = request.params.arguments;
|
|
513
|
+
if (!args?.topic) {
|
|
514
|
+
return {
|
|
515
|
+
content: [
|
|
516
|
+
{
|
|
517
|
+
type: "text",
|
|
518
|
+
text: "Error: 'topic' parameter is required. Use run_api_docs with topic='start' for overview.",
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
isError: true,
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
try {
|
|
525
|
+
const documentation = handleRunApiDocs(args.topic, args.detail_level, args.include_schemas);
|
|
526
|
+
return {
|
|
527
|
+
content: [
|
|
528
|
+
{
|
|
529
|
+
type: "text",
|
|
530
|
+
text: documentation,
|
|
531
|
+
},
|
|
532
|
+
],
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
catch (error) {
|
|
536
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
537
|
+
return {
|
|
538
|
+
content: [
|
|
539
|
+
{
|
|
540
|
+
type: "text",
|
|
541
|
+
text: `Error retrieving Run API documentation: ${errorMessage}`,
|
|
542
|
+
},
|
|
543
|
+
],
|
|
544
|
+
isError: true,
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
}
|
|
509
548
|
return {
|
|
510
549
|
content: [
|
|
511
550
|
{
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting utilities for API documentation output
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base URL information included with any topic that has endpoints
|
|
6
|
+
*/
|
|
7
|
+
const BASE_URL_INFO = `## Base URL
|
|
8
|
+
\`\`\`
|
|
9
|
+
https://<your-instance-subdomain>.xano.io/api:meta/<endpoint>
|
|
10
|
+
\`\`\`
|
|
11
|
+
Authorization: \`Bearer <your-access-token>\`
|
|
12
|
+
`;
|
|
13
|
+
function formatParameter(param) {
|
|
14
|
+
const required = param.required ? " (required)" : "";
|
|
15
|
+
const defaultVal = param.default !== undefined ? ` [default: ${param.default}]` : "";
|
|
16
|
+
const enumVals = param.enum ? ` [options: ${param.enum.join(", ")}]` : "";
|
|
17
|
+
return ` - \`${param.name}\`: ${param.type}${required}${defaultVal}${enumVals} - ${param.description}`;
|
|
18
|
+
}
|
|
19
|
+
function formatEndpoint(ep, detailLevel) {
|
|
20
|
+
const lines = [];
|
|
21
|
+
// Method and path
|
|
22
|
+
lines.push(`### ${ep.method} ${ep.path}`);
|
|
23
|
+
if (ep.tool_name) {
|
|
24
|
+
lines.push(`**Tool:** \`${ep.tool_name}\``);
|
|
25
|
+
}
|
|
26
|
+
lines.push("");
|
|
27
|
+
lines.push(ep.description);
|
|
28
|
+
if (detailLevel === "overview") {
|
|
29
|
+
return lines.join("\n");
|
|
30
|
+
}
|
|
31
|
+
// Parameters
|
|
32
|
+
if (ep.parameters?.length) {
|
|
33
|
+
lines.push("");
|
|
34
|
+
lines.push("**Parameters:**");
|
|
35
|
+
for (const param of ep.parameters) {
|
|
36
|
+
lines.push(formatParameter(param));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Request body
|
|
40
|
+
if (ep.request_body) {
|
|
41
|
+
lines.push("");
|
|
42
|
+
lines.push(`**Request Body:** \`${ep.request_body.type}\``);
|
|
43
|
+
if (ep.request_body.properties) {
|
|
44
|
+
for (const [key, val] of Object.entries(ep.request_body.properties)) {
|
|
45
|
+
const req = val.required ? " (required)" : "";
|
|
46
|
+
lines.push(` - \`${key}\`: ${val.type}${req} - ${val.description || ""}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Example (only in detailed/examples mode)
|
|
51
|
+
if (detailLevel === "examples" && ep.example) {
|
|
52
|
+
lines.push("");
|
|
53
|
+
lines.push("**Example:**");
|
|
54
|
+
lines.push("```");
|
|
55
|
+
lines.push(`${ep.example.method} ${ep.example.path}`);
|
|
56
|
+
if (ep.example.body) {
|
|
57
|
+
lines.push(JSON.stringify(ep.example.body, null, 2));
|
|
58
|
+
}
|
|
59
|
+
lines.push("```");
|
|
60
|
+
}
|
|
61
|
+
return lines.join("\n");
|
|
62
|
+
}
|
|
63
|
+
function formatExample(ex) {
|
|
64
|
+
const lines = [];
|
|
65
|
+
lines.push(`### ${ex.title}`);
|
|
66
|
+
lines.push("");
|
|
67
|
+
lines.push(ex.description);
|
|
68
|
+
lines.push("");
|
|
69
|
+
lines.push("**Request:**");
|
|
70
|
+
lines.push("```");
|
|
71
|
+
lines.push(`${ex.request.method} ${ex.request.path}`);
|
|
72
|
+
if (ex.request.headers) {
|
|
73
|
+
for (const [key, val] of Object.entries(ex.request.headers)) {
|
|
74
|
+
lines.push(`${key}: ${val}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (ex.request.body) {
|
|
78
|
+
lines.push("");
|
|
79
|
+
lines.push(JSON.stringify(ex.request.body, null, 2));
|
|
80
|
+
}
|
|
81
|
+
lines.push("```");
|
|
82
|
+
if (ex.response !== undefined) {
|
|
83
|
+
lines.push("");
|
|
84
|
+
lines.push("**Response:**");
|
|
85
|
+
lines.push("```json");
|
|
86
|
+
lines.push(JSON.stringify(ex.response, null, 2));
|
|
87
|
+
lines.push("```");
|
|
88
|
+
}
|
|
89
|
+
return lines.join("\n");
|
|
90
|
+
}
|
|
91
|
+
function formatPattern(pattern) {
|
|
92
|
+
const lines = [];
|
|
93
|
+
lines.push(`### ${pattern.name}`);
|
|
94
|
+
if (pattern.description) {
|
|
95
|
+
lines.push("");
|
|
96
|
+
lines.push(pattern.description);
|
|
97
|
+
}
|
|
98
|
+
lines.push("");
|
|
99
|
+
lines.push("**Steps:**");
|
|
100
|
+
for (const step of pattern.steps) {
|
|
101
|
+
lines.push(step);
|
|
102
|
+
}
|
|
103
|
+
if (pattern.example) {
|
|
104
|
+
lines.push("");
|
|
105
|
+
lines.push("**Example:**");
|
|
106
|
+
lines.push("```");
|
|
107
|
+
lines.push(pattern.example);
|
|
108
|
+
lines.push("```");
|
|
109
|
+
}
|
|
110
|
+
return lines.join("\n");
|
|
111
|
+
}
|
|
112
|
+
export function formatDocumentation(doc, detailLevel = "detailed", includeSchemas = true) {
|
|
113
|
+
const sections = [];
|
|
114
|
+
// Header
|
|
115
|
+
sections.push(`# ${doc.title}`);
|
|
116
|
+
sections.push("");
|
|
117
|
+
sections.push(doc.description);
|
|
118
|
+
// AI Hints (always include for AI optimization)
|
|
119
|
+
if (doc.ai_hints) {
|
|
120
|
+
sections.push("");
|
|
121
|
+
sections.push("## AI Usage Hints");
|
|
122
|
+
sections.push(doc.ai_hints);
|
|
123
|
+
}
|
|
124
|
+
// Include base URL info if topic has endpoints or patterns (workflows)
|
|
125
|
+
if (doc.endpoints?.length || doc.patterns?.length) {
|
|
126
|
+
sections.push("");
|
|
127
|
+
sections.push(BASE_URL_INFO);
|
|
128
|
+
}
|
|
129
|
+
// Endpoints
|
|
130
|
+
if (doc.endpoints?.length) {
|
|
131
|
+
sections.push("## Endpoints");
|
|
132
|
+
for (const ep of doc.endpoints) {
|
|
133
|
+
sections.push("");
|
|
134
|
+
sections.push(formatEndpoint(ep, detailLevel));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Patterns/Workflows
|
|
138
|
+
if (doc.patterns?.length) {
|
|
139
|
+
sections.push("");
|
|
140
|
+
sections.push("## Workflows");
|
|
141
|
+
for (const pattern of doc.patterns) {
|
|
142
|
+
sections.push("");
|
|
143
|
+
sections.push(formatPattern(pattern));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Examples
|
|
147
|
+
if ((detailLevel === "detailed" || detailLevel === "examples") && doc.examples?.length) {
|
|
148
|
+
sections.push("");
|
|
149
|
+
sections.push("## Examples");
|
|
150
|
+
for (const ex of doc.examples) {
|
|
151
|
+
sections.push("");
|
|
152
|
+
sections.push(formatExample(ex));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Schemas
|
|
156
|
+
if (includeSchemas && doc.schemas && Object.keys(doc.schemas).length > 0) {
|
|
157
|
+
sections.push("");
|
|
158
|
+
sections.push("## Schemas");
|
|
159
|
+
sections.push("");
|
|
160
|
+
sections.push("```json");
|
|
161
|
+
sections.push(JSON.stringify(doc.schemas, null, 2));
|
|
162
|
+
sections.push("```");
|
|
163
|
+
}
|
|
164
|
+
// Related topics
|
|
165
|
+
if (doc.related_topics?.length) {
|
|
166
|
+
sections.push("");
|
|
167
|
+
sections.push("## Related Topics");
|
|
168
|
+
sections.push(`Use \`meta_api_docs\` with topic: ${doc.related_topics.join(", ")}`);
|
|
169
|
+
}
|
|
170
|
+
return sections.join("\n");
|
|
171
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xano Meta API Documentation Index
|
|
3
|
+
*
|
|
4
|
+
* This module exports all documentation topics and provides
|
|
5
|
+
* the meta_api_docs tool handler for the MCP server.
|
|
6
|
+
*/
|
|
7
|
+
import type { TopicDoc, MetaApiDocsArgs } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* All available documentation topics
|
|
10
|
+
*/
|
|
11
|
+
export declare const topics: Record<string, TopicDoc>;
|
|
12
|
+
/**
|
|
13
|
+
* Get list of all available topic names
|
|
14
|
+
*/
|
|
15
|
+
export declare function getTopicNames(): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Get topic descriptions for tool documentation
|
|
18
|
+
*/
|
|
19
|
+
export declare function getTopicDescriptions(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Handler for the meta_api_docs tool
|
|
22
|
+
*/
|
|
23
|
+
export declare function handleMetaApiDocs(args: MetaApiDocsArgs): string;
|
|
24
|
+
/**
|
|
25
|
+
* Tool definition for MCP server
|
|
26
|
+
*/
|
|
27
|
+
export declare const metaApiDocsToolDefinition: {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: string;
|
|
32
|
+
properties: {
|
|
33
|
+
topic: {
|
|
34
|
+
type: string;
|
|
35
|
+
enum: string[];
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
detail_level: {
|
|
39
|
+
type: string;
|
|
40
|
+
enum: string[];
|
|
41
|
+
default: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
include_schemas: {
|
|
45
|
+
type: string;
|
|
46
|
+
default: boolean;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
required: string[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xano Meta API Documentation Index
|
|
3
|
+
*
|
|
4
|
+
* This module exports all documentation topics and provides
|
|
5
|
+
* the meta_api_docs tool handler for the MCP server.
|
|
6
|
+
*/
|
|
7
|
+
import { formatDocumentation } from "./format.js";
|
|
8
|
+
// Import all topic documentation
|
|
9
|
+
import { startDoc } from "./topics/start.js";
|
|
10
|
+
import { authenticationDoc } from "./topics/authentication.js";
|
|
11
|
+
import { workspaceDoc } from "./topics/workspace.js";
|
|
12
|
+
import { apigroupDoc } from "./topics/apigroup.js";
|
|
13
|
+
import { apiDoc } from "./topics/api.js";
|
|
14
|
+
import { tableDoc } from "./topics/table.js";
|
|
15
|
+
import { functionDoc } from "./topics/function.js";
|
|
16
|
+
import { taskDoc } from "./topics/task.js";
|
|
17
|
+
import { agentDoc } from "./topics/agent.js";
|
|
18
|
+
import { toolDoc } from "./topics/tool.js";
|
|
19
|
+
import { mcpServerDoc } from "./topics/mcp_server.js";
|
|
20
|
+
import { middlewareDoc } from "./topics/middleware.js";
|
|
21
|
+
import { branchDoc } from "./topics/branch.js";
|
|
22
|
+
import { realtimeDoc } from "./topics/realtime.js";
|
|
23
|
+
import { fileDoc } from "./topics/file.js";
|
|
24
|
+
import { historyDoc } from "./topics/history.js";
|
|
25
|
+
import { workflowsDoc } from "./topics/workflows.js";
|
|
26
|
+
/**
|
|
27
|
+
* All available documentation topics
|
|
28
|
+
*/
|
|
29
|
+
export const topics = {
|
|
30
|
+
start: startDoc,
|
|
31
|
+
authentication: authenticationDoc,
|
|
32
|
+
workspace: workspaceDoc,
|
|
33
|
+
apigroup: apigroupDoc,
|
|
34
|
+
api: apiDoc,
|
|
35
|
+
table: tableDoc,
|
|
36
|
+
function: functionDoc,
|
|
37
|
+
task: taskDoc,
|
|
38
|
+
agent: agentDoc,
|
|
39
|
+
tool: toolDoc,
|
|
40
|
+
mcp_server: mcpServerDoc,
|
|
41
|
+
middleware: middlewareDoc,
|
|
42
|
+
branch: branchDoc,
|
|
43
|
+
realtime: realtimeDoc,
|
|
44
|
+
file: fileDoc,
|
|
45
|
+
history: historyDoc,
|
|
46
|
+
workflows: workflowsDoc,
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Get list of all available topic names
|
|
50
|
+
*/
|
|
51
|
+
export function getTopicNames() {
|
|
52
|
+
return Object.keys(topics);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get topic descriptions for tool documentation
|
|
56
|
+
*/
|
|
57
|
+
export function getTopicDescriptions() {
|
|
58
|
+
return Object.entries(topics)
|
|
59
|
+
.map(([key, doc]) => `- ${key}: ${doc.title}`)
|
|
60
|
+
.join("\n");
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Handler for the meta_api_docs tool
|
|
64
|
+
*/
|
|
65
|
+
export function handleMetaApiDocs(args) {
|
|
66
|
+
const { topic, detail_level = "detailed", include_schemas = true } = args;
|
|
67
|
+
// Validate topic
|
|
68
|
+
if (!topics[topic]) {
|
|
69
|
+
const available = getTopicNames().join(", ");
|
|
70
|
+
return `Error: Unknown topic "${topic}".\n\nAvailable topics: ${available}`;
|
|
71
|
+
}
|
|
72
|
+
const doc = topics[topic];
|
|
73
|
+
return formatDocumentation(doc, detail_level, include_schemas);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Tool definition for MCP server
|
|
77
|
+
*/
|
|
78
|
+
export const metaApiDocsToolDefinition = {
|
|
79
|
+
name: "meta_api_docs",
|
|
80
|
+
description: `Get documentation for Xano's Meta API. Use this to understand how to programmatically manage Xano workspaces, databases, APIs, functions, agents, and more.
|
|
81
|
+
|
|
82
|
+
## Topics
|
|
83
|
+
${getTopicDescriptions()}
|
|
84
|
+
|
|
85
|
+
## Usage
|
|
86
|
+
- Start with "start" topic for overview and getting started
|
|
87
|
+
- Use "workflows" for step-by-step guides
|
|
88
|
+
- Use specific topics (workspace, table, api, etc.) for detailed endpoint docs`,
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {
|
|
92
|
+
topic: {
|
|
93
|
+
type: "string",
|
|
94
|
+
enum: getTopicNames(),
|
|
95
|
+
description: "Documentation topic to retrieve",
|
|
96
|
+
},
|
|
97
|
+
detail_level: {
|
|
98
|
+
type: "string",
|
|
99
|
+
enum: ["overview", "detailed", "examples"],
|
|
100
|
+
default: "detailed",
|
|
101
|
+
description: "Level of detail: overview (brief), detailed (full docs), examples (with code examples)",
|
|
102
|
+
},
|
|
103
|
+
include_schemas: {
|
|
104
|
+
type: "boolean",
|
|
105
|
+
default: true,
|
|
106
|
+
description: "Include JSON schemas for requests/responses",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
required: ["topic"],
|
|
110
|
+
},
|
|
111
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export const agentDoc = {
|
|
2
|
+
topic: "agent",
|
|
3
|
+
title: "AI Agent Management",
|
|
4
|
+
description: `Agents are AI-powered automation units that use LLMs (like Claude) to make decisions and execute multi-step workflows.
|
|
5
|
+
|
|
6
|
+
## Key Concepts
|
|
7
|
+
- Agents use LLMs for reasoning and decision-making
|
|
8
|
+
- Can call tools to perform actions
|
|
9
|
+
- Support multiple LLM providers (Anthropic, OpenAI, etc.)
|
|
10
|
+
- Configurable system prompts, temperature, max steps
|
|
11
|
+
- Can have triggers that invoke them automatically
|
|
12
|
+
|
|
13
|
+
## LLM Configuration
|
|
14
|
+
- Type: Provider (e.g., "anthropic")
|
|
15
|
+
- Model: Specific model (e.g., "claude-4-sonnet-20250514")
|
|
16
|
+
- System prompt: Instructions for the agent
|
|
17
|
+
- Temperature: Creativity level (0-1)
|
|
18
|
+
- Max steps: Maximum reasoning iterations
|
|
19
|
+
- Reasoning: Enable/disable chain-of-thought`,
|
|
20
|
+
ai_hints: `- Create tools first, then create agent and associate tools
|
|
21
|
+
- System prompt is critical for agent behavior
|
|
22
|
+
- Lower temperature = more deterministic responses
|
|
23
|
+
- Max steps limits runaway agent loops
|
|
24
|
+
- Use triggers to invoke agents on events (table changes, etc.)`,
|
|
25
|
+
endpoints: [
|
|
26
|
+
{
|
|
27
|
+
method: "GET",
|
|
28
|
+
path: "/workspace/{workspace_id}/agent",
|
|
29
|
+
tool_name: "listAgents",
|
|
30
|
+
description: "List all AI agents 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 agent name" },
|
|
36
|
+
{ name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript definition" },
|
|
37
|
+
{ name: "include_draft", type: "boolean", default: false, description: "Include draft versions" }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: "/workspace/{workspace_id}/agent/{agent_id}",
|
|
43
|
+
tool_name: "getAgent",
|
|
44
|
+
description: "Get details of a specific AI agent.",
|
|
45
|
+
parameters: [
|
|
46
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
47
|
+
{ name: "agent_id", type: "integer", required: true, in: "path", description: "Agent ID" },
|
|
48
|
+
{ name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript definition" },
|
|
49
|
+
{ name: "include_draft", type: "boolean", default: false, description: "Include draft version" }
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
method: "POST",
|
|
54
|
+
path: "/workspace/{workspace_id}/agent",
|
|
55
|
+
tool_name: "createAgent",
|
|
56
|
+
description: "Create a new AI agent with LLM configuration.",
|
|
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: "Agent name", required: true },
|
|
64
|
+
description: { type: "string", description: "Agent description" },
|
|
65
|
+
xanoscript: { type: "string", description: "XanoScript agent definition", required: true }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
example: {
|
|
69
|
+
method: "POST",
|
|
70
|
+
path: "/workspace/1/agent",
|
|
71
|
+
body: {
|
|
72
|
+
name: "support_agent",
|
|
73
|
+
description: "Customer support AI agent",
|
|
74
|
+
xanoscript: `agent support_agent {
|
|
75
|
+
llm {
|
|
76
|
+
type = "anthropic"
|
|
77
|
+
model = "claude-4-sonnet-20250514"
|
|
78
|
+
system_prompt = "You are a helpful customer support agent."
|
|
79
|
+
max_steps = 10
|
|
80
|
+
temperature = 0.3
|
|
81
|
+
}
|
|
82
|
+
tools = [lookup_order, update_ticket]
|
|
83
|
+
}`
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
method: "PUT",
|
|
89
|
+
path: "/workspace/{workspace_id}/agent/{agent_id}",
|
|
90
|
+
tool_name: "updateAgent",
|
|
91
|
+
description: "Update an existing AI agent.",
|
|
92
|
+
parameters: [
|
|
93
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
94
|
+
{ name: "agent_id", type: "integer", required: true, in: "path", description: "Agent ID" },
|
|
95
|
+
{ name: "publish", type: "boolean", default: true, description: "Publish changes immediately" }
|
|
96
|
+
],
|
|
97
|
+
request_body: {
|
|
98
|
+
type: "application/json",
|
|
99
|
+
properties: {
|
|
100
|
+
name: { type: "string", description: "Agent name" },
|
|
101
|
+
description: { type: "string", description: "Agent description" },
|
|
102
|
+
xanoscript: { type: "string", description: "XanoScript agent definition" }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
method: "DELETE",
|
|
108
|
+
path: "/workspace/{workspace_id}/agent/{agent_id}",
|
|
109
|
+
tool_name: "deleteAgent",
|
|
110
|
+
description: "Delete an AI agent.",
|
|
111
|
+
parameters: [
|
|
112
|
+
{ name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
|
|
113
|
+
{ name: "agent_id", type: "integer", required: true, in: "path", description: "Agent ID" }
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
schemas: {
|
|
118
|
+
Agent: {
|
|
119
|
+
type: "object",
|
|
120
|
+
properties: {
|
|
121
|
+
id: { type: "integer" },
|
|
122
|
+
name: { type: "string" },
|
|
123
|
+
description: { type: "string" },
|
|
124
|
+
llm: {
|
|
125
|
+
type: "object",
|
|
126
|
+
properties: {
|
|
127
|
+
type: { type: "string", description: "LLM provider (anthropic, openai, etc.)" },
|
|
128
|
+
model: { type: "string", description: "Model identifier" },
|
|
129
|
+
system_prompt: { type: "string" },
|
|
130
|
+
max_steps: { type: "integer" },
|
|
131
|
+
temperature: { type: "number" },
|
|
132
|
+
reasoning: { type: "boolean" }
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
tools: { type: "array", items: { type: "string" } },
|
|
136
|
+
created_at: { type: "string", format: "date-time" },
|
|
137
|
+
updated_at: { type: "string", format: "date-time" }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
related_topics: ["tool", "mcp_server", "function"]
|
|
142
|
+
};
|