@xano/developer-mcp 1.0.27 → 1.0.28

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.
Files changed (76) hide show
  1. package/README.md +1 -1
  2. package/dist/api_docs/format.d.ts +5 -0
  3. package/dist/api_docs/format.js +171 -0
  4. package/dist/api_docs/index.d.ts +52 -0
  5. package/dist/api_docs/index.js +111 -0
  6. package/dist/api_docs/topics/agent.d.ts +2 -0
  7. package/dist/api_docs/topics/agent.js +142 -0
  8. package/dist/api_docs/topics/api.d.ts +2 -0
  9. package/dist/api_docs/topics/api.js +176 -0
  10. package/dist/api_docs/topics/apigroup.d.ts +2 -0
  11. package/dist/api_docs/topics/apigroup.js +124 -0
  12. package/dist/api_docs/topics/authentication.d.ts +2 -0
  13. package/dist/api_docs/topics/authentication.js +61 -0
  14. package/dist/api_docs/topics/branch.d.ts +2 -0
  15. package/dist/api_docs/topics/branch.js +73 -0
  16. package/dist/api_docs/topics/file.d.ts +2 -0
  17. package/dist/api_docs/topics/file.js +70 -0
  18. package/dist/api_docs/topics/function.d.ts +2 -0
  19. package/dist/api_docs/topics/function.js +164 -0
  20. package/dist/api_docs/topics/history.d.ts +2 -0
  21. package/dist/api_docs/topics/history.js +149 -0
  22. package/dist/api_docs/topics/mcp_server.d.ts +2 -0
  23. package/dist/api_docs/topics/mcp_server.js +139 -0
  24. package/dist/api_docs/topics/middleware.d.ts +2 -0
  25. package/dist/api_docs/topics/middleware.js +156 -0
  26. package/dist/api_docs/topics/realtime.d.ts +2 -0
  27. package/dist/api_docs/topics/realtime.js +112 -0
  28. package/dist/api_docs/topics/start.d.ts +2 -0
  29. package/dist/api_docs/topics/start.js +107 -0
  30. package/dist/api_docs/topics/table.d.ts +2 -0
  31. package/dist/api_docs/topics/table.js +195 -0
  32. package/dist/api_docs/topics/task.d.ts +2 -0
  33. package/dist/api_docs/topics/task.js +165 -0
  34. package/dist/api_docs/topics/tool.d.ts +2 -0
  35. package/dist/api_docs/topics/tool.js +150 -0
  36. package/dist/api_docs/topics/workflows.d.ts +2 -0
  37. package/dist/api_docs/topics/workflows.js +131 -0
  38. package/dist/api_docs/topics/workspace.d.ts +2 -0
  39. package/dist/api_docs/topics/workspace.js +153 -0
  40. package/dist/api_docs/types.d.ts +79 -0
  41. package/dist/api_docs/types.js +4 -0
  42. package/dist/meta_api_docs/topics/workspace.js +45 -2
  43. package/dist/templates/init-workspace.d.ts +10 -0
  44. package/dist/templates/init-workspace.js +278 -0
  45. package/dist/templates/xanoscript-index.d.ts +11 -0
  46. package/dist/templates/xanoscript-index.js +72 -0
  47. package/dist/xanoscript_docs/README.md +3 -13
  48. package/dist/xanoscript_docs/ephemeral.md +330 -0
  49. package/dist/xanoscript_docs/functions.md +0 -21
  50. package/dist/xanoscript_docs/integrations.md +0 -10
  51. package/dist/xanoscript_docs/performance.md +1 -10
  52. package/dist/xanoscript_docs/realtime.md +1 -48
  53. package/dist/xanoscript_docs/security.md +2 -0
  54. package/dist/xanoscript_docs/tools.md +2 -21
  55. package/dist/xanoscript_docs/triggers.md +2 -27
  56. package/dist/xanoscript_docs_auto/README.md +119 -0
  57. package/dist/xanoscript_docs_auto/agents.md +446 -0
  58. package/dist/xanoscript_docs_auto/apis.md +517 -0
  59. package/dist/xanoscript_docs_auto/control-flow.md +543 -0
  60. package/dist/xanoscript_docs_auto/database.md +551 -0
  61. package/dist/xanoscript_docs_auto/debugging.md +527 -0
  62. package/dist/xanoscript_docs_auto/filters.md +464 -0
  63. package/dist/xanoscript_docs_auto/functions.md +431 -0
  64. package/dist/xanoscript_docs_auto/integrations.md +657 -0
  65. package/dist/xanoscript_docs_auto/mcp-servers.md +408 -0
  66. package/dist/xanoscript_docs_auto/operators.md +368 -0
  67. package/dist/xanoscript_docs_auto/syntax.md +287 -0
  68. package/dist/xanoscript_docs_auto/tables.md +447 -0
  69. package/dist/xanoscript_docs_auto/tasks.md +479 -0
  70. package/dist/xanoscript_docs_auto/testing.md +574 -0
  71. package/dist/xanoscript_docs_auto/tools.md +485 -0
  72. package/dist/xanoscript_docs_auto/triggers.md +595 -0
  73. package/dist/xanoscript_docs_auto/types.md +323 -0
  74. package/dist/xanoscript_docs_auto/variables.md +462 -0
  75. package/dist/xanoscript_docs_auto/version.json +5 -0
  76. package/package.json +1 -1
package/README.md CHANGED
@@ -40,7 +40,7 @@ This MCP server acts as a bridge between AI models and Xano's developer ecosyste
40
40
  ### Claude Code (Recommended)
41
41
 
42
42
  ```bash
43
- claude mcp add xano-developer -- npx -y @xano/developer-mcp
43
+ claude mcp add xano -- npx -y @xano/developer-mcp
44
44
  ```
45
45
 
46
46
  That's it! The MCP server will be automatically installed and configured.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Formatting utilities for API documentation output
3
+ */
4
+ import type { TopicDoc, DetailLevel } from "./types.js";
5
+ export declare function formatDocumentation(doc: TopicDoc, detailLevel?: DetailLevel, includeSchemas?: boolean): string;
@@ -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 \`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 api_docs tool handler for the MCP server.
6
+ */
7
+ import type { TopicDoc, ApiDocsArgs } 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 api_docs tool
22
+ */
23
+ export declare function handleApiDocs(args: ApiDocsArgs): string;
24
+ /**
25
+ * Tool definition for MCP server
26
+ */
27
+ export declare const apiDocsToolDefinition: {
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 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 api_docs tool
64
+ */
65
+ export function handleApiDocs(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 apiDocsToolDefinition = {
79
+ name: "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,2 @@
1
+ import type { TopicDoc } from "../types.js";
2
+ export declare const agentDoc: TopicDoc;
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ import type { TopicDoc } from "../types.js";
2
+ export declare const apiDoc: TopicDoc;
@@ -0,0 +1,176 @@
1
+ export const apiDoc = {
2
+ topic: "api",
3
+ title: "API Endpoint Management",
4
+ description: `API endpoints define individual HTTP routes within an API group. Each endpoint has a path, HTTP method, inputs, and XanoScript logic.
5
+
6
+ ## Key Concepts
7
+ - Endpoints belong to API groups
8
+ - Each endpoint has: method (GET/POST/PUT/DELETE), path, inputs, and stack (logic)
9
+ - Supports path parameters like \`/users/{id}\`
10
+ - XanoScript defines the endpoint logic`,
11
+ ai_hints: `- Use \`include_xanoscript=true\` to see the endpoint's implementation
12
+ - Check existing endpoints before creating to avoid duplicates
13
+ - Path parameters use \`{param_name}\` syntax
14
+ - Common patterns: CRUD operations, search, authentication
15
+ - Security settings can override group-level settings`,
16
+ endpoints: [
17
+ {
18
+ method: "GET",
19
+ path: "/workspace/{workspace_id}/apigroup/{apigroup_id}/api",
20
+ tool_name: "listApis",
21
+ description: "List all API endpoints in an API group.",
22
+ parameters: [
23
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
24
+ { name: "apigroup_id", type: "integer", required: true, in: "path", description: "API Group ID" },
25
+ { name: "page", type: "integer", default: 1, description: "Page number" },
26
+ { name: "per_page", type: "integer", default: 50, description: "Items per page" },
27
+ { name: "search", type: "string", description: "Search by name or path" },
28
+ { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript code in response" },
29
+ { name: "include_draft", type: "boolean", default: false, description: "Include draft versions" },
30
+ { name: "branch", type: "string", description: "Filter by branch name" }
31
+ ]
32
+ },
33
+ {
34
+ method: "GET",
35
+ path: "/workspace/{workspace_id}/apigroup/{apigroup_id}/api/{api_id}",
36
+ tool_name: "getApi",
37
+ description: "Get details of a specific API endpoint.",
38
+ parameters: [
39
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
40
+ { name: "apigroup_id", type: "integer", required: true, in: "path", description: "API Group ID" },
41
+ { name: "api_id", type: "integer", required: true, in: "path", description: "API ID" },
42
+ { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript code" },
43
+ { name: "include_draft", type: "boolean", default: false, description: "Include draft version" }
44
+ ]
45
+ },
46
+ {
47
+ method: "POST",
48
+ path: "/workspace/{workspace_id}/apigroup/{apigroup_id}/api",
49
+ tool_name: "createApi",
50
+ description: "Create a new API endpoint with XanoScript logic.",
51
+ parameters: [
52
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
53
+ { name: "apigroup_id", type: "integer", required: true, in: "path", description: "API Group ID" }
54
+ ],
55
+ request_body: {
56
+ type: "application/json",
57
+ properties: {
58
+ name: { type: "string", description: "Endpoint name", required: true },
59
+ path: { type: "string", description: "URL path (e.g., /users/{id})", required: true },
60
+ verb: { type: "string", description: "HTTP method: GET, POST, PUT, DELETE", required: true },
61
+ description: { type: "string", description: "Endpoint description" },
62
+ xanoscript: { type: "string", description: "XanoScript code defining the endpoint logic" }
63
+ }
64
+ },
65
+ example: {
66
+ method: "POST",
67
+ path: "/workspace/1/apigroup/2/api",
68
+ body: {
69
+ name: "getUsers",
70
+ path: "/users",
71
+ verb: "GET",
72
+ xanoscript: "query getUsers {\n response = db.users.query().all()\n}"
73
+ }
74
+ }
75
+ },
76
+ {
77
+ method: "PUT",
78
+ path: "/workspace/{workspace_id}/apigroup/{apigroup_id}/api/{api_id}",
79
+ tool_name: "updateApi",
80
+ description: "Update an existing API endpoint.",
81
+ parameters: [
82
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
83
+ { name: "apigroup_id", type: "integer", required: true, in: "path", description: "API Group ID" },
84
+ { name: "api_id", type: "integer", required: true, in: "path", description: "API ID" },
85
+ { name: "publish", type: "boolean", default: true, description: "Publish changes immediately" }
86
+ ],
87
+ request_body: {
88
+ type: "application/json",
89
+ properties: {
90
+ name: { type: "string", description: "Endpoint name" },
91
+ path: { type: "string", description: "URL path" },
92
+ verb: { type: "string", description: "HTTP method" },
93
+ description: { type: "string", description: "Endpoint description" },
94
+ xanoscript: { type: "string", description: "XanoScript code" }
95
+ }
96
+ }
97
+ },
98
+ {
99
+ method: "DELETE",
100
+ path: "/workspace/{workspace_id}/apigroup/{apigroup_id}/api/{api_id}",
101
+ tool_name: "deleteApi",
102
+ description: "Delete an API endpoint.",
103
+ parameters: [
104
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
105
+ { name: "apigroup_id", type: "integer", required: true, in: "path", description: "API Group ID" },
106
+ { name: "api_id", type: "integer", required: true, in: "path", description: "API ID" }
107
+ ]
108
+ },
109
+ {
110
+ method: "PUT",
111
+ path: "/workspace/{workspace_id}/apigroup/{apigroup_id}/api/{api_id}/security",
112
+ tool_name: "updateApiSecurity",
113
+ description: "Update security settings for a specific endpoint (overrides group settings).",
114
+ parameters: [
115
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
116
+ { name: "apigroup_id", type: "integer", required: true, in: "path", description: "API Group ID" },
117
+ { name: "api_id", type: "integer", required: true, in: "path", description: "API ID" }
118
+ ],
119
+ request_body: {
120
+ type: "application/json",
121
+ properties: {
122
+ guid: { type: "string", description: "Security group GUID" }
123
+ }
124
+ }
125
+ }
126
+ ],
127
+ schemas: {
128
+ Api: {
129
+ type: "object",
130
+ properties: {
131
+ id: { type: "integer" },
132
+ name: { type: "string" },
133
+ path: { type: "string" },
134
+ verb: { type: "string", enum: ["GET", "POST", "PUT", "DELETE"] },
135
+ description: { type: "string" },
136
+ xanoscript: { type: "string", description: "Only included if include_xanoscript=true" },
137
+ created_at: { type: "string", format: "date-time" },
138
+ updated_at: { type: "string", format: "date-time" }
139
+ }
140
+ }
141
+ },
142
+ examples: [
143
+ {
144
+ title: "Create a GET endpoint",
145
+ description: "Create a simple endpoint to list all users",
146
+ request: {
147
+ method: "POST",
148
+ path: "/workspace/1/apigroup/2/api",
149
+ body: {
150
+ name: "listUsers",
151
+ path: "/users",
152
+ verb: "GET",
153
+ xanoscript: `query listUsers {
154
+ input {
155
+ int page = 1
156
+ int per_page = 20
157
+ }
158
+ stack {
159
+ var $users {
160
+ value = db.users.query().paginate($input.page, $input.per_page)
161
+ }
162
+ }
163
+ response = $users
164
+ }`
165
+ }
166
+ },
167
+ response: {
168
+ id: 123,
169
+ name: "listUsers",
170
+ path: "/users",
171
+ verb: "GET"
172
+ }
173
+ }
174
+ ],
175
+ related_topics: ["apigroup", "function", "table"]
176
+ };
@@ -0,0 +1,2 @@
1
+ import type { TopicDoc } from "../types.js";
2
+ export declare const apigroupDoc: TopicDoc;