@xano/developer-mcp 1.0.75 → 2.0.0

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 (127) hide show
  1. package/README.md +104 -37
  2. package/dist/cli_docs/index.d.ts +13 -37
  3. package/dist/cli_docs/index.js +28 -39
  4. package/dist/cli_docs/topics/integration.js +1 -1
  5. package/dist/cli_docs/topics/workspace.js +1 -1
  6. package/dist/index.js +58 -55
  7. package/dist/lib.d.ts +3 -1
  8. package/dist/lib.js +1 -1
  9. package/dist/meta_api_docs/format.js +1 -1
  10. package/dist/meta_api_docs/index.d.ts +14 -42
  11. package/dist/meta_api_docs/index.js +34 -46
  12. package/dist/tools/cli_docs.d.ts +2 -3
  13. package/dist/tools/cli_docs.js +3 -5
  14. package/dist/tools/define_tool.d.ts +47 -0
  15. package/dist/tools/define_tool.js +36 -0
  16. package/dist/tools/index.d.ts +88 -221
  17. package/dist/tools/index.js +80 -109
  18. package/dist/tools/mcp_version.d.ts +4 -25
  19. package/dist/tools/mcp_version.js +12 -19
  20. package/dist/tools/meta_api_docs.d.ts +2 -3
  21. package/dist/tools/meta_api_docs.js +3 -5
  22. package/dist/tools/validate_xanoscript.d.ts +18 -65
  23. package/dist/tools/validate_xanoscript.js +56 -54
  24. package/dist/tools/xanoscript_docs.d.ts +25 -74
  25. package/dist/tools/xanoscript_docs.js +86 -83
  26. package/dist/xanoscript_docs/README.md +5 -5
  27. package/dist/xanoscript_docs/apis.md +2 -2
  28. package/dist/xanoscript_docs/database.md +1 -1
  29. package/dist/xanoscript_docs/essentials.md +6 -6
  30. package/dist/xanoscript_docs/functions.md +3 -3
  31. package/dist/xanoscript_docs/integrations.md +5 -5
  32. package/dist/xanoscript_docs/middleware.md +1 -1
  33. package/dist/xanoscript_docs/performance.md +4 -4
  34. package/dist/xanoscript_docs/realtime.md +2 -2
  35. package/dist/xanoscript_docs/security.md +1 -1
  36. package/dist/xanoscript_docs/survival.md +1 -1
  37. package/dist/xanoscript_docs/syntax/string-filters.md +1 -1
  38. package/dist/xanoscript_docs/syntax.md +9 -9
  39. package/dist/xanoscript_docs/tools.md +2 -2
  40. package/dist/xanoscript_docs/types.md +2 -2
  41. package/dist/xanoscript_docs/unit-testing.md +1 -1
  42. package/dist/xanoscript_docs/workflow-tests.md +1 -1
  43. package/dist/xanoscript_docs/working.md +4 -4
  44. package/package.json +5 -4
  45. package/dist/api_docs/format.d.ts +0 -5
  46. package/dist/api_docs/format.js +0 -171
  47. package/dist/api_docs/index.d.ts +0 -52
  48. package/dist/api_docs/index.js +0 -111
  49. package/dist/api_docs/topics/agent.d.ts +0 -2
  50. package/dist/api_docs/topics/agent.js +0 -142
  51. package/dist/api_docs/topics/api.d.ts +0 -2
  52. package/dist/api_docs/topics/api.js +0 -176
  53. package/dist/api_docs/topics/apigroup.d.ts +0 -2
  54. package/dist/api_docs/topics/apigroup.js +0 -124
  55. package/dist/api_docs/topics/authentication.d.ts +0 -2
  56. package/dist/api_docs/topics/authentication.js +0 -61
  57. package/dist/api_docs/topics/branch.d.ts +0 -2
  58. package/dist/api_docs/topics/branch.js +0 -73
  59. package/dist/api_docs/topics/file.d.ts +0 -2
  60. package/dist/api_docs/topics/file.js +0 -70
  61. package/dist/api_docs/topics/function.d.ts +0 -2
  62. package/dist/api_docs/topics/function.js +0 -164
  63. package/dist/api_docs/topics/history.d.ts +0 -2
  64. package/dist/api_docs/topics/history.js +0 -149
  65. package/dist/api_docs/topics/mcp_server.d.ts +0 -2
  66. package/dist/api_docs/topics/mcp_server.js +0 -139
  67. package/dist/api_docs/topics/middleware.d.ts +0 -2
  68. package/dist/api_docs/topics/middleware.js +0 -156
  69. package/dist/api_docs/topics/realtime.d.ts +0 -2
  70. package/dist/api_docs/topics/realtime.js +0 -112
  71. package/dist/api_docs/topics/start.d.ts +0 -2
  72. package/dist/api_docs/topics/start.js +0 -107
  73. package/dist/api_docs/topics/table.d.ts +0 -2
  74. package/dist/api_docs/topics/table.js +0 -195
  75. package/dist/api_docs/topics/task.d.ts +0 -2
  76. package/dist/api_docs/topics/task.js +0 -165
  77. package/dist/api_docs/topics/tool.d.ts +0 -2
  78. package/dist/api_docs/topics/tool.js +0 -150
  79. package/dist/api_docs/topics/workflows.d.ts +0 -2
  80. package/dist/api_docs/topics/workflows.js +0 -131
  81. package/dist/api_docs/topics/workspace.d.ts +0 -2
  82. package/dist/api_docs/topics/workspace.js +0 -153
  83. package/dist/api_docs/types.d.ts +0 -79
  84. package/dist/api_docs/types.js +0 -4
  85. package/dist/cli_docs/topics/run.d.ts +0 -2
  86. package/dist/cli_docs/topics/run.js +0 -248
  87. package/dist/meta_api_docs/format.test.d.ts +0 -1
  88. package/dist/meta_api_docs/format.test.js +0 -272
  89. package/dist/meta_api_docs/index.test.d.ts +0 -1
  90. package/dist/meta_api_docs/index.test.js +0 -128
  91. package/dist/meta_api_docs/types.test.d.ts +0 -1
  92. package/dist/meta_api_docs/types.test.js +0 -132
  93. package/dist/templates/init-workspace.d.ts +0 -10
  94. package/dist/templates/init-workspace.js +0 -278
  95. package/dist/templates/xanoscript-index.d.ts +0 -11
  96. package/dist/templates/xanoscript-index.js +0 -72
  97. package/dist/tools/index.test.d.ts +0 -1
  98. package/dist/tools/index.test.js +0 -179
  99. package/dist/tools/xanoscript_docs.test.d.ts +0 -1
  100. package/dist/tools/xanoscript_docs.test.js +0 -197
  101. package/dist/xanoscript.test.d.ts +0 -1
  102. package/dist/xanoscript.test.js +0 -421
  103. package/dist/xanoscript_docs/cheatsheet.md +0 -287
  104. package/dist/xanoscript_docs/ephemeral.md +0 -330
  105. package/dist/xanoscript_docs/quickstart.md +0 -692
  106. package/dist/xanoscript_docs/run.md +0 -196
  107. package/dist/xanoscript_docs/schema.md +0 -300
  108. package/dist/xanoscript_docs_auto/README.md +0 -119
  109. package/dist/xanoscript_docs_auto/agents.md +0 -446
  110. package/dist/xanoscript_docs_auto/apis.md +0 -517
  111. package/dist/xanoscript_docs_auto/control-flow.md +0 -543
  112. package/dist/xanoscript_docs_auto/database.md +0 -551
  113. package/dist/xanoscript_docs_auto/debugging.md +0 -527
  114. package/dist/xanoscript_docs_auto/filters.md +0 -464
  115. package/dist/xanoscript_docs_auto/functions.md +0 -431
  116. package/dist/xanoscript_docs_auto/integrations.md +0 -657
  117. package/dist/xanoscript_docs_auto/mcp-servers.md +0 -408
  118. package/dist/xanoscript_docs_auto/operators.md +0 -368
  119. package/dist/xanoscript_docs_auto/syntax.md +0 -287
  120. package/dist/xanoscript_docs_auto/tables.md +0 -447
  121. package/dist/xanoscript_docs_auto/tasks.md +0 -479
  122. package/dist/xanoscript_docs_auto/testing.md +0 -574
  123. package/dist/xanoscript_docs_auto/tools.md +0 -485
  124. package/dist/xanoscript_docs_auto/triggers.md +0 -595
  125. package/dist/xanoscript_docs_auto/types.md +0 -323
  126. package/dist/xanoscript_docs_auto/variables.md +0 -462
  127. package/dist/xanoscript_docs_auto/version.json +0 -5
@@ -1,248 +0,0 @@
1
- export const runDoc = {
2
- topic: "run",
3
- title: "Xano CLI - Run API Commands",
4
- description: `Run commands let you execute XanoScript code, manage Run projects, sessions, environment variables, and secrets. The Run API enables serverless execution of XanoScript.
5
-
6
- ## Run API Base URL
7
-
8
- \`https://app.dev.xano.com/api:run\`
9
-
10
- This is different from your instance URL used by the Meta API.`,
11
- ai_hints: `**Run vs Meta API:**
12
- - Run API: Execute code, manage runtime environment
13
- - Meta API: Manage workspace resources (tables, APIs, functions)
14
-
15
- **Project context:**
16
- - Most run commands require a project
17
- - Set project in profile or use \`-j\` flag
18
- - Projects isolate execution environments
19
-
20
- **Execution modes:**
21
- - Jobs: One-time execution, returns result
22
- - Services: Long-running, exposes endpoints
23
-
24
- **Environment variables:**
25
- - Stored per-project in Run API
26
- - Override at runtime with \`--env KEY=value\``,
27
- related_topics: ["function", "profile", "integration"],
28
- commands: [
29
- {
30
- name: "run:exec",
31
- description: "Execute XanoScript code",
32
- usage: "xano run:exec [path] [options]",
33
- args: [
34
- { name: "path", required: false, description: "Path to .xs file, directory, or URL" }
35
- ],
36
- flags: [
37
- { name: "project", short: "j", type: "string", required: false, description: "Run project ID" },
38
- { name: "args", short: "a", type: "string", required: false, description: "JSON file with input arguments" },
39
- { name: "env", type: "string", required: false, description: "Environment override KEY=value (repeatable)" },
40
- { name: "stdin", type: "boolean", required: false, description: "Read code from stdin" },
41
- { name: "edit", type: "boolean", required: false, description: "Open in $EDITOR before execution" }
42
- ],
43
- examples: [
44
- "xano run:exec ./job.xs",
45
- "xano run:exec ./job.xs -a inputs.json",
46
- "xano run:exec ./job.xs --env API_KEY=secret --env DEBUG=true",
47
- "echo 'var:x = 1 + 1' | xano run:exec --stdin",
48
- "xano run:exec ./scripts/ # executes all .xs files as multidoc"
49
- ]
50
- },
51
- {
52
- name: "run:info",
53
- description: "Analyze XanoScript without executing",
54
- usage: "xano run:info [path] [options]",
55
- args: [
56
- { name: "path", required: false, description: "Path to .xs file" }
57
- ],
58
- flags: [
59
- { name: "stdin", type: "boolean", required: false, description: "Read from stdin" }
60
- ],
61
- examples: [
62
- "xano run:info ./job.xs",
63
- "cat script.xs | xano run:info --stdin"
64
- ]
65
- },
66
- {
67
- name: "run:projects:list",
68
- description: "List all Run projects",
69
- usage: "xano run:projects:list",
70
- examples: ["xano run:projects:list"]
71
- },
72
- {
73
- name: "run:projects:create",
74
- description: "Create a new Run project",
75
- usage: "xano run:projects:create [options]",
76
- flags: [
77
- { name: "name", short: "n", type: "string", required: true, description: "Project name" },
78
- { name: "description", short: "d", type: "string", required: false, description: "Project description" }
79
- ],
80
- examples: ["xano run:projects:create -n 'My Project' -d 'Production jobs'"]
81
- },
82
- {
83
- name: "run:projects:update",
84
- description: "Update a Run project",
85
- usage: "xano run:projects:update <project_id> [options]",
86
- args: [
87
- { name: "project_id", required: true, description: "Project ID to update" }
88
- ],
89
- flags: [
90
- { name: "name", short: "n", type: "string", required: false, description: "New project name" },
91
- { name: "description", short: "d", type: "string", required: false, description: "New description" }
92
- ],
93
- examples: ["xano run:projects:update abc123 -n 'Updated Name'"]
94
- },
95
- {
96
- name: "run:projects:delete",
97
- description: "Delete a Run project",
98
- usage: "xano run:projects:delete <project_id> [--force]",
99
- args: [
100
- { name: "project_id", required: true, description: "Project ID to delete" }
101
- ],
102
- flags: [
103
- { name: "force", type: "boolean", required: false, description: "Skip confirmation" }
104
- ],
105
- examples: ["xano run:projects:delete abc123 --force"]
106
- },
107
- {
108
- name: "run:env:list",
109
- description: "List environment variables for project",
110
- usage: "xano run:env:list [-j <project>]",
111
- examples: ["xano run:env:list"]
112
- },
113
- {
114
- name: "run:env:set",
115
- description: "Set an environment variable",
116
- usage: "xano run:env:set <name> <value> [-j <project>]",
117
- args: [
118
- { name: "name", required: true, description: "Variable name" },
119
- { name: "value", required: true, description: "Variable value" }
120
- ],
121
- examples: ["xano run:env:set API_KEY sk-123456"]
122
- },
123
- {
124
- name: "run:env:get",
125
- description: "Get an environment variable value",
126
- usage: "xano run:env:get <name> [-j <project>]",
127
- args: [
128
- { name: "name", required: true, description: "Variable name" }
129
- ],
130
- examples: ["xano run:env:get API_KEY"]
131
- },
132
- {
133
- name: "run:env:delete",
134
- description: "Delete an environment variable",
135
- usage: "xano run:env:delete <name> [-j <project>]",
136
- args: [
137
- { name: "name", required: true, description: "Variable name" }
138
- ],
139
- examples: ["xano run:env:delete OLD_KEY"]
140
- },
141
- {
142
- name: "run:sessions:list",
143
- description: "List execution sessions",
144
- usage: "xano run:sessions:list [-j <project>]",
145
- examples: ["xano run:sessions:list"]
146
- },
147
- {
148
- name: "run:sessions:get",
149
- description: "Get session details",
150
- usage: "xano run:sessions:get <session_id>",
151
- args: [
152
- { name: "session_id", required: true, description: "Session ID" }
153
- ],
154
- examples: ["xano run:sessions:get sess_abc123"]
155
- },
156
- {
157
- name: "run:sessions:start",
158
- description: "Start a session",
159
- usage: "xano run:sessions:start <session_id>",
160
- args: [
161
- { name: "session_id", required: true, description: "Session ID" }
162
- ],
163
- examples: ["xano run:sessions:start sess_abc123"]
164
- },
165
- {
166
- name: "run:sessions:stop",
167
- description: "Stop a session",
168
- usage: "xano run:sessions:stop <session_id>",
169
- args: [
170
- { name: "session_id", required: true, description: "Session ID" }
171
- ],
172
- examples: ["xano run:sessions:stop sess_abc123"]
173
- },
174
- {
175
- name: "run:sessions:delete",
176
- description: "Delete a session",
177
- usage: "xano run:sessions:delete <session_id>",
178
- args: [
179
- { name: "session_id", required: true, description: "Session ID" }
180
- ],
181
- examples: ["xano run:sessions:delete sess_abc123"]
182
- },
183
- {
184
- name: "run:secrets:list",
185
- description: "List secrets",
186
- usage: "xano run:secrets:list [-j <project>]",
187
- examples: ["xano run:secrets:list"]
188
- },
189
- {
190
- name: "run:secrets:set",
191
- description: "Set a secret (docker registry or service account)",
192
- usage: "xano run:secrets:set <name> [options]",
193
- args: [
194
- { name: "name", required: true, description: "Secret name" }
195
- ],
196
- flags: [
197
- { name: "type", short: "t", type: "string", required: true, description: "Secret type: dockerconfigjson, service-account-token" }
198
- ],
199
- examples: ["xano run:secrets:set docker-creds -t dockerconfigjson"]
200
- },
201
- {
202
- name: "run:secrets:get",
203
- description: "Get a secret",
204
- usage: "xano run:secrets:get <name>",
205
- args: [
206
- { name: "name", required: true, description: "Secret name" }
207
- ],
208
- examples: ["xano run:secrets:get docker-creds"]
209
- },
210
- {
211
- name: "run:secrets:delete",
212
- description: "Delete a secret",
213
- usage: "xano run:secrets:delete <name>",
214
- args: [
215
- { name: "name", required: true, description: "Secret name" }
216
- ],
217
- examples: ["xano run:secrets:delete old-secret"]
218
- }
219
- ],
220
- workflows: [
221
- {
222
- name: "Execute a Job",
223
- description: "Run XanoScript code and get results",
224
- steps: [
225
- "Write your job in a .xs file",
226
- "Execute: `xano run:exec ./job.xs`",
227
- "View timing and response in output"
228
- ],
229
- example: `# job.xs
230
- job: my_job
231
- ---
232
- var:result = 1 + 1
233
- return = var:result
234
-
235
- # Execute
236
- xano run:exec ./job.xs`
237
- },
238
- {
239
- name: "Configure Environment",
240
- description: "Set up environment variables for a project",
241
- steps: [
242
- "List existing: `xano run:env:list`",
243
- "Set variables: `xano run:env:set KEY value`",
244
- "Execute with overrides: `xano run:exec job.xs --env KEY=override`"
245
- ]
246
- }
247
- ]
248
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,272 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { formatDocumentation, META_API_CONFIG, } from "./format.js";
3
- describe("meta_api_docs/format", () => {
4
- describe("META_API_CONFIG", () => {
5
- it("should have correct base URL info", () => {
6
- expect(META_API_CONFIG.baseUrlInfo).toContain("https://<your-instance-subdomain>.xano.io/api:meta/");
7
- expect(META_API_CONFIG.toolName).toBe("meta_api_docs");
8
- });
9
- });
10
- describe("formatDocumentation", () => {
11
- const minimalDoc = {
12
- topic: "test",
13
- title: "Test Topic",
14
- description: "A test topic description",
15
- };
16
- it("should format minimal documentation", () => {
17
- const result = formatDocumentation(minimalDoc);
18
- expect(result).toContain("# Test Topic");
19
- expect(result).toContain("A test topic description");
20
- });
21
- it("should include AI hints when present", () => {
22
- const docWithHints = {
23
- ...minimalDoc,
24
- ai_hints: "Use this for testing purposes",
25
- };
26
- const result = formatDocumentation(docWithHints);
27
- expect(result).toContain("## AI Usage Hints");
28
- expect(result).toContain("Use this for testing purposes");
29
- });
30
- it("should format endpoints correctly", () => {
31
- const docWithEndpoints = {
32
- ...minimalDoc,
33
- endpoints: [
34
- {
35
- method: "GET",
36
- path: "/test",
37
- description: "Get test data",
38
- },
39
- {
40
- method: "POST",
41
- path: "/test",
42
- description: "Create test data",
43
- tool_name: "create_test",
44
- },
45
- ],
46
- };
47
- const result = formatDocumentation(docWithEndpoints);
48
- expect(result).toContain("## Endpoints");
49
- expect(result).toContain("### GET /test");
50
- expect(result).toContain("### POST /test");
51
- expect(result).toContain("**Tool:** `create_test`");
52
- });
53
- it("should format endpoint parameters", () => {
54
- const docWithParams = {
55
- ...minimalDoc,
56
- endpoints: [
57
- {
58
- method: "GET",
59
- path: "/test/{id}",
60
- description: "Get test by ID",
61
- parameters: [
62
- {
63
- name: "id",
64
- type: "integer",
65
- required: true,
66
- description: "The test ID",
67
- },
68
- {
69
- name: "include_details",
70
- type: "boolean",
71
- required: false,
72
- default: false,
73
- description: "Include extra details",
74
- },
75
- {
76
- name: "format",
77
- type: "string",
78
- description: "Output format",
79
- enum: ["json", "xml", "csv"],
80
- },
81
- ],
82
- },
83
- ],
84
- };
85
- const result = formatDocumentation(docWithParams);
86
- expect(result).toContain("**Parameters:**");
87
- expect(result).toContain("`id`: integer (required)");
88
- expect(result).toContain("`include_details`: boolean [default: false]");
89
- expect(result).toContain("[options: json, xml, csv]");
90
- });
91
- it("should format request body", () => {
92
- const docWithBody = {
93
- ...minimalDoc,
94
- endpoints: [
95
- {
96
- method: "POST",
97
- path: "/test",
98
- description: "Create test",
99
- request_body: {
100
- type: "object",
101
- properties: {
102
- name: {
103
- type: "string",
104
- required: true,
105
- description: "The name",
106
- },
107
- value: {
108
- type: "number",
109
- description: "The value",
110
- },
111
- },
112
- },
113
- },
114
- ],
115
- };
116
- const result = formatDocumentation(docWithBody);
117
- expect(result).toContain("**Request Body:** `object`");
118
- expect(result).toContain("`name`: string (required)");
119
- expect(result).toContain("`value`: number");
120
- });
121
- it("should format examples in detailed mode", () => {
122
- const docWithExamples = {
123
- ...minimalDoc,
124
- examples: [
125
- {
126
- title: "Basic Example",
127
- description: "A simple example",
128
- request: {
129
- method: "GET",
130
- path: "/test",
131
- headers: { Authorization: "Bearer token" },
132
- },
133
- response: { data: "test" },
134
- },
135
- ],
136
- };
137
- const result = formatDocumentation(docWithExamples, "detailed");
138
- expect(result).toContain("## Examples");
139
- expect(result).toContain("### Basic Example");
140
- expect(result).toContain("**Request:**");
141
- expect(result).toContain("GET /test");
142
- expect(result).toContain("Authorization: Bearer token");
143
- expect(result).toContain("**Response:**");
144
- });
145
- it("should format examples with request body", () => {
146
- const docWithBodyExample = {
147
- ...minimalDoc,
148
- examples: [
149
- {
150
- title: "Create Example",
151
- description: "Creating data",
152
- request: {
153
- method: "POST",
154
- path: "/test",
155
- body: { name: "test", value: 42 },
156
- },
157
- },
158
- ],
159
- };
160
- const result = formatDocumentation(docWithBodyExample, "detailed");
161
- expect(result).toContain('"name": "test"');
162
- expect(result).toContain('"value": 42');
163
- });
164
- it("should format patterns/workflows", () => {
165
- const docWithPatterns = {
166
- ...minimalDoc,
167
- patterns: [
168
- {
169
- name: "Basic Workflow",
170
- description: "A simple workflow",
171
- steps: ["1. Do step 1", "2. Do step 2", "3. Do step 3"],
172
- example: "example code here",
173
- },
174
- ],
175
- };
176
- const result = formatDocumentation(docWithPatterns);
177
- expect(result).toContain("## Workflows");
178
- expect(result).toContain("### Basic Workflow");
179
- expect(result).toContain("A simple workflow");
180
- expect(result).toContain("**Steps:**");
181
- expect(result).toContain("1. Do step 1");
182
- expect(result).toContain("**Example:**");
183
- expect(result).toContain("example code here");
184
- });
185
- it("should include schemas when includeSchemas is true", () => {
186
- const docWithSchemas = {
187
- ...minimalDoc,
188
- schemas: {
189
- TestSchema: {
190
- type: "object",
191
- properties: {
192
- id: { type: "integer" },
193
- },
194
- },
195
- },
196
- };
197
- const result = formatDocumentation(docWithSchemas, "detailed", true);
198
- expect(result).toContain("## Schemas");
199
- expect(result).toContain('"TestSchema"');
200
- });
201
- it("should exclude schemas when includeSchemas is false", () => {
202
- const docWithSchemas = {
203
- ...minimalDoc,
204
- schemas: {
205
- TestSchema: { type: "object" },
206
- },
207
- };
208
- const result = formatDocumentation(docWithSchemas, "detailed", false);
209
- expect(result).not.toContain("## Schemas");
210
- });
211
- it("should include related topics", () => {
212
- const docWithRelated = {
213
- ...minimalDoc,
214
- related_topics: ["topic1", "topic2", "topic3"],
215
- };
216
- const result = formatDocumentation(docWithRelated);
217
- expect(result).toContain("## Related Topics");
218
- expect(result).toContain("topic1, topic2, topic3");
219
- expect(result).toContain("meta_api_docs");
220
- });
221
- it("should use custom config", () => {
222
- const customConfig = {
223
- baseUrlInfo: "## Base URL\nhttps://custom.example.com/api/",
224
- toolName: "custom_docs",
225
- };
226
- const result = formatDocumentation({ ...minimalDoc, patterns: [{ name: "Test", steps: ["step"] }] }, "detailed", true, customConfig);
227
- expect(result).toContain("https://custom.example.com/api/");
228
- });
229
- describe("detail levels", () => {
230
- const docWithAll = {
231
- ...minimalDoc,
232
- endpoints: [
233
- {
234
- method: "GET",
235
- path: "/test",
236
- description: "Test endpoint",
237
- parameters: [
238
- { name: "id", type: "integer", required: true, description: "ID" },
239
- ],
240
- example: {
241
- method: "GET",
242
- path: "/test/1",
243
- },
244
- },
245
- ],
246
- examples: [
247
- {
248
- title: "Example",
249
- description: "Test",
250
- request: { method: "GET", path: "/test" },
251
- },
252
- ],
253
- };
254
- it("overview should show minimal endpoint info", () => {
255
- const result = formatDocumentation(docWithAll, "overview");
256
- expect(result).toContain("### GET /test");
257
- expect(result).toContain("Test endpoint");
258
- expect(result).not.toContain("**Parameters:**");
259
- });
260
- it("detailed should show parameters but not inline examples", () => {
261
- const result = formatDocumentation(docWithAll, "detailed");
262
- expect(result).toContain("**Parameters:**");
263
- expect(result).toContain("## Examples");
264
- });
265
- it("examples should show inline examples in endpoints", () => {
266
- const result = formatDocumentation(docWithAll, "examples");
267
- expect(result).toContain("**Example:**");
268
- expect(result).toContain("GET /test/1");
269
- });
270
- });
271
- });
272
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,128 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { topics, getTopicNames, getTopicDescriptions, handleMetaApiDocs, metaApiDocsToolDefinition, } from "./index.js";
3
- describe("meta_api_docs/index", () => {
4
- describe("topics", () => {
5
- it("should have all expected topics", () => {
6
- const expectedTopics = [
7
- "start",
8
- "authentication",
9
- "workspace",
10
- "apigroup",
11
- "api",
12
- "table",
13
- "function",
14
- "task",
15
- "agent",
16
- "tool",
17
- "mcp_server",
18
- "middleware",
19
- "branch",
20
- "realtime",
21
- "file",
22
- "history",
23
- "workflows",
24
- ];
25
- expect(Object.keys(topics)).toEqual(expectedTopics);
26
- });
27
- it("should have valid TopicDoc structure for each topic", () => {
28
- for (const [key, doc] of Object.entries(topics)) {
29
- expect(doc).toHaveProperty("topic");
30
- expect(doc).toHaveProperty("title");
31
- expect(doc).toHaveProperty("description");
32
- expect(typeof doc.topic).toBe("string");
33
- expect(typeof doc.title).toBe("string");
34
- expect(typeof doc.description).toBe("string");
35
- expect(doc.topic).toBe(key);
36
- }
37
- });
38
- });
39
- describe("getTopicNames", () => {
40
- it("should return all topic names", () => {
41
- const names = getTopicNames();
42
- expect(names).toEqual(Object.keys(topics));
43
- });
44
- it("should return an array of strings", () => {
45
- const names = getTopicNames();
46
- expect(Array.isArray(names)).toBe(true);
47
- names.forEach((name) => {
48
- expect(typeof name).toBe("string");
49
- });
50
- });
51
- });
52
- describe("getTopicDescriptions", () => {
53
- it("should return formatted topic descriptions", () => {
54
- const descriptions = getTopicDescriptions();
55
- expect(typeof descriptions).toBe("string");
56
- expect(descriptions).toContain("- start:");
57
- expect(descriptions).toContain("- workspace:");
58
- expect(descriptions).toContain("- api:");
59
- });
60
- it("should include all topics", () => {
61
- const descriptions = getTopicDescriptions();
62
- for (const key of Object.keys(topics)) {
63
- expect(descriptions).toContain(`- ${key}:`);
64
- }
65
- });
66
- });
67
- describe("handleMetaApiDocs", () => {
68
- it("should return error for unknown topic", () => {
69
- const result = handleMetaApiDocs({ topic: "nonexistent" });
70
- expect(result).toContain('Error: Unknown topic "nonexistent"');
71
- expect(result).toContain("Available topics:");
72
- });
73
- it("should return documentation for valid topic", () => {
74
- const result = handleMetaApiDocs({ topic: "start" });
75
- expect(result).toContain("Xano Meta API - Getting Started");
76
- expect(result).not.toContain("Error:");
77
- });
78
- it("should use default detail_level of detailed", () => {
79
- const result = handleMetaApiDocs({ topic: "start" });
80
- expect(result).toContain("Examples");
81
- });
82
- it("should respect overview detail_level", () => {
83
- const result = handleMetaApiDocs({
84
- topic: "start",
85
- detail_level: "overview",
86
- });
87
- expect(result).toContain("Xano Meta API");
88
- });
89
- it("should respect examples detail_level", () => {
90
- const result = handleMetaApiDocs({
91
- topic: "start",
92
- detail_level: "examples",
93
- });
94
- expect(result).toContain("Examples");
95
- });
96
- it("should include schemas by default", () => {
97
- const result = handleMetaApiDocs({ topic: "workspace" });
98
- // Schemas may or may not be present depending on the topic
99
- expect(typeof result).toBe("string");
100
- });
101
- it("should respect include_schemas=false", () => {
102
- const result = handleMetaApiDocs({
103
- topic: "workspace",
104
- include_schemas: false,
105
- });
106
- expect(typeof result).toBe("string");
107
- });
108
- });
109
- describe("metaApiDocsToolDefinition", () => {
110
- it("should have required tool properties", () => {
111
- expect(metaApiDocsToolDefinition).toHaveProperty("name", "meta_api_docs");
112
- expect(metaApiDocsToolDefinition).toHaveProperty("description");
113
- expect(metaApiDocsToolDefinition).toHaveProperty("inputSchema");
114
- });
115
- it("should have valid inputSchema", () => {
116
- const schema = metaApiDocsToolDefinition.inputSchema;
117
- expect(schema.type).toBe("object");
118
- expect(schema.properties).toHaveProperty("topic");
119
- expect(schema.properties).toHaveProperty("detail_level");
120
- expect(schema.properties).toHaveProperty("include_schemas");
121
- expect(schema.required).toEqual(["topic"]);
122
- });
123
- it("should include all topic names in enum", () => {
124
- const topicEnum = metaApiDocsToolDefinition.inputSchema.properties.topic.enum;
125
- expect(topicEnum).toEqual(getTopicNames());
126
- });
127
- });
128
- });
@@ -1 +0,0 @@
1
- export {};