@xano/developer-mcp 2.0.5 → 2.1.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.
package/README.md CHANGED
@@ -224,9 +224,12 @@ console.log(`${dirResult.valid_files}/${dirResult.total_files} files valid`);
224
224
  ```typescript
225
225
  import { xanoscriptDocs } from '@xano/developer-mcp';
226
226
 
227
- // Get overview (README)
228
- const overview = xanoscriptDocs();
229
- console.log(overview.documentation);
227
+ // Get the compact topic index (the no-arg default; ~4KB / ~1K tokens)
228
+ const index = xanoscriptDocs();
229
+ console.log(index.documentation);
230
+
231
+ // Get the full prose overview (the previous no-arg default)
232
+ const overview = xanoscriptDocs({ topic: 'readme' });
230
233
 
231
234
  // Get specific topic
232
235
  const syntaxDocs = xanoscriptDocs({ topic: 'syntax' });
@@ -236,9 +239,6 @@ const apiDocs = xanoscriptDocs({ file_path: 'api/users/create_post.xs' });
236
239
 
237
240
  // Get compact quick reference
238
241
  const quickRef = xanoscriptDocs({ topic: 'database', mode: 'quick_reference' });
239
-
240
- // Get topic index with sizes
241
- const index = xanoscriptDocs({ mode: 'index' });
242
242
  ```
243
243
 
244
244
  ### Get Meta API Documentation
@@ -360,7 +360,7 @@ xano_validate_xanoscript({ directory: "src", pattern: "api/**/*.xs" })
360
360
 
361
361
  ### 2. `xano_xanoscript_docs`
362
362
 
363
- Retrieves XanoScript programming language documentation with context-aware support.
363
+ Retrieves XanoScript programming language documentation with context-aware support. Called with no parameters, it returns a compact topic index (~4KB / ~1K tokens) for orientation; use `topic='readme'` for the full prose overview, or `topic=`/`file_path=` to drill in.
364
364
 
365
365
  **Parameters:**
366
366
  | Parameter | Type | Required | Description |
@@ -368,7 +368,7 @@ Retrieves XanoScript programming language documentation with context-aware suppo
368
368
  | `topic` | string | No | Specific documentation topic to retrieve |
369
369
  | `file_path` | string | No | File path being edited for context-aware docs (e.g., `api/users/create_post.xs`) |
370
370
  | `mode` | string | No | `full` (default), `quick_reference` for compact syntax reference, or `index` for topic listing with sizes |
371
- | `tier` | string | No | Pre-packaged documentation tier for context-limited models: `survival` (~800 tokens) or `working` (~3500 tokens). Overrides topic/file_path/mode when set |
371
+ | `tier` | string | No | Pre-packaged documentation tier for context-limited models: `survival` (~1.2K tokens) or `working` (~4.4K tokens). Overrides topic/file_path/mode when set |
372
372
  | `max_tokens` | number | No | Maximum estimated token budget. Loads topics in priority order until budget is reached. Helps prevent context overflow for small-window models |
373
373
  | `exclude_topics` | string[] | No | Topic names to exclude from `file_path` results (e.g., topics already loaded) |
374
374
 
@@ -376,8 +376,8 @@ Retrieves XanoScript programming language documentation with context-aware suppo
376
376
 
377
377
  | Topic | Description |
378
378
  |-------|-------------|
379
- | `survival` | Minimal syntax survival kit (~3KB, ~800 tokens) for models with <16K context |
380
- | `working` | Complete working reference (~12KB, ~3500 tokens) for models with 16-64K context |
379
+ | `survival` | Minimal syntax survival kit (~5KB, ~1.2K tokens) for models with <16K context — reach via `tier='survival'` |
380
+ | `working` | Complete working reference (~17KB, ~4.4K tokens) for models with 16-64K context — reach via `tier='working'` |
381
381
  | `readme` | XanoScript overview, workspace structure, and quick reference |
382
382
  | `essentials` | Common patterns, quick reference, and common mistakes to avoid |
383
383
  | `syntax` | Expressions, operators, and filters for all XanoScript code |
@@ -415,13 +415,16 @@ Retrieves XanoScript programming language documentation with context-aware suppo
415
415
 
416
416
  **Examples:**
417
417
  ```
418
- // Get overview
418
+ // Get the compact topic index (no-arg default)
419
419
  xano_xanoscript_docs()
420
420
 
421
- // Get survival kit for small context models (~800 tokens)
421
+ // Get the full prose overview (previous no-arg default)
422
+ xano_xanoscript_docs({ topic: "readme" })
423
+
424
+ // Get survival kit for small context models (~1.2K tokens)
422
425
  xano_xanoscript_docs({ tier: "survival" })
423
426
 
424
- // Get working reference for medium context models (~3500 tokens)
427
+ // Get working reference for medium context models (~4.4K tokens)
425
428
  xano_xanoscript_docs({ tier: "working" })
426
429
 
427
430
  // Get essentials (recommended first stop)
@@ -563,8 +566,8 @@ The server also exposes XanoScript documentation as MCP resources for direct acc
563
566
 
564
567
  | Resource URI | Description |
565
568
  |--------------|-------------|
566
- | `xanoscript://docs/survival` | Minimal syntax survival kit (~800 tokens) |
567
- | `xanoscript://docs/working` | Complete working reference (~3500 tokens) |
569
+ | `xanoscript://docs/survival` | Minimal syntax survival kit (~1.2K tokens) |
570
+ | `xanoscript://docs/working` | Complete working reference (~4.4K tokens) |
568
571
  | `xanoscript://docs/readme` | Overview and quick reference |
569
572
  | `xanoscript://docs/essentials` | Common patterns, quick reference, and common mistakes to avoid |
570
573
  | `xanoscript://docs/syntax` | Expressions, operators, and filters |
@@ -32,8 +32,8 @@ export declare function setXanoscriptDocsPath(path: string): void;
32
32
  * ```ts
33
33
  * import { xanoscriptDocs } from '@xano/developer-mcp';
34
34
  *
35
- * // Get overview
36
- * const overview = xanoscriptDocs();
35
+ * // Get compact topic index (use topic: 'readme' for the full prose overview)
36
+ * const index = xanoscriptDocs();
37
37
  *
38
38
  * // Get specific topic
39
39
  * const syntaxDocs = xanoscriptDocs({ topic: 'syntax' });
@@ -8,7 +8,7 @@ import { readFileSync } from "fs";
8
8
  import { dirname, join } from "path";
9
9
  import { fileURLToPath } from "url";
10
10
  import { z } from "zod";
11
- import { readXanoscriptDocsV2, readXanoscriptDocsStructured, getXanoscriptDocsVersion, getTopicNames, getTopicDescriptions, } from "../xanoscript.js";
11
+ import { readXanoscriptDocsV2, readXanoscriptDocsStructured, getXanoscriptDocsVersion, getTopicNames, getTopicDescriptions, getTierFacts, } from "../xanoscript.js";
12
12
  import { defineTool } from "./define_tool.js";
13
13
  // =============================================================================
14
14
  // Path Resolution
@@ -71,8 +71,8 @@ export function setXanoscriptDocsPath(path) {
71
71
  * ```ts
72
72
  * import { xanoscriptDocs } from '@xano/developer-mcp';
73
73
  *
74
- * // Get overview
75
- * const overview = xanoscriptDocs();
74
+ * // Get compact topic index (use topic: 'readme' for the full prose overview)
75
+ * const index = xanoscriptDocs();
76
76
  *
77
77
  * // Get specific topic
78
78
  * const syntaxDocs = xanoscriptDocs({ topic: 'syntax' });
@@ -157,11 +157,14 @@ export function xanoscriptDocsTool(args) {
157
157
  // MCP Tool Definition
158
158
  // =============================================================================
159
159
  const topicEnumValues = getTopicNames();
160
+ // Derive tier size facts from the actual files so the advertised numbers can
161
+ // never drift stale (see getTierFacts). Computed once at module load.
162
+ const tierFacts = getTierFacts(getXanoscriptDocsPath());
160
163
  export const xanoscriptDocsToolSpec = defineTool({
161
164
  name: "xano_xanoscript_docs",
162
165
  description: "Get XanoScript programming language documentation for AI code generation. " +
163
- "Call without parameters for overview (README). " +
164
- "For context-limited models: use tier='survival' (~800 tokens) or tier='working' (~3500 tokens). " +
166
+ "Call without parameters for a compact index of all topics (~4KB, ~1K tokens); then drill in with topic= or file_path=. Use topic='readme' for the full prose overview (previously the no-arg default). " +
167
+ `For context-limited models: use tier='survival' (~${tierFacts.survival.tokens}) or tier='working' (~${tierFacts.working.tokens}). ` +
165
168
  "Use 'topic' for specific documentation, or 'file_path' for context-aware docs based on the file you're editing. " +
166
169
  "Use mode='quick_reference' for compact syntax reference (recommended for context efficiency). " +
167
170
  "Use max_tokens to limit documentation size to fit your context budget. " +
@@ -176,7 +179,7 @@ export const xanoscriptDocsToolSpec = defineTool({
176
179
  topic: z
177
180
  .enum(topicEnumValues)
178
181
  .optional()
179
- .describe("Documentation topic to retrieve. Call without any parameters to get the README overview. " +
182
+ .describe("Documentation topic to retrieve. Call without any parameters to get the compact topic index; use topic='readme' for the full prose overview. " +
180
183
  "Example: topic='syntax' for language syntax, topic='database' for database operations, topic='types' for type system.\n\n" +
181
184
  "Available topics:\n" +
182
185
  getTopicDescriptions()),
@@ -192,7 +195,8 @@ export const xanoscriptDocsToolSpec = defineTool({
192
195
  .optional()
193
196
  .describe("'full' = complete documentation with explanations and examples. " +
194
197
  "'quick_reference' = compact reference with just syntax patterns and signatures. " +
195
- "'index' = compact topic listing with descriptions and byte sizes (~1KB). " +
198
+ "'index' = compact topic listing with descriptions and byte sizes (~4KB, ~1K tokens). " +
199
+ "When set, 'index' takes precedence over topic and file_path. " +
196
200
  "Use 'index' to discover available topics before loading them. " +
197
201
  "Use 'quick_reference' to save context window space when you just need a reminder. " +
198
202
  "Default: 'full' for topic mode, 'quick_reference' for file_path mode."),
@@ -200,8 +204,8 @@ export const xanoscriptDocsToolSpec = defineTool({
200
204
  .enum(["survival", "working"])
201
205
  .optional()
202
206
  .describe("Pre-packaged documentation tier for context-limited models. " +
203
- "'survival' (~3KB, ~800 tokens): minimum syntax to write valid XanoScript. " +
204
- "'working' (~12KB, ~3500 tokens): complete reference for common tasks. " +
207
+ `'survival' (~${tierFacts.survival.kb}, ~${tierFacts.survival.tokens}): minimum syntax to write valid XanoScript. ` +
208
+ `'working' (~${tierFacts.working.kb}, ~${tierFacts.working.tokens}): complete reference for common tasks. ` +
205
209
  "Overrides topic/file_path/mode when set. " +
206
210
  "Use 'survival' for models with <16K context, 'working' for 16-64K context."),
207
211
  max_tokens: z
@@ -222,7 +226,7 @@ export const xanoscriptDocsToolSpec = defineTool({
222
226
  documentation: z
223
227
  .string()
224
228
  .optional()
225
- .describe("The documentation content (topic or README mode)."),
229
+ .describe("The documentation content (index, topic, tier, or file_path mode)."),
226
230
  file_path: z
227
231
  .string()
228
232
  .optional()
@@ -8,6 +8,11 @@ export interface DocConfig {
8
8
  file: string;
9
9
  applyTo: string[];
10
10
  description: string;
11
+ /**
12
+ * Load order under a `max_tokens` budget for file_path mode: LOWER loads
13
+ * first (and so survives truncation). Topics sharing a value fall back to
14
+ * docs_index.json declaration order. Omitted (undefined) sorts last (99).
15
+ */
11
16
  priority?: number;
12
17
  }
13
18
  export interface XanoscriptDocsArgs {
@@ -24,6 +29,24 @@ export declare const XANOSCRIPT_DOCS_V2: Record<string, DocConfig>;
24
29
  * Useful for testing or when docs files change at runtime.
25
30
  */
26
31
  export declare function clearDocsCache(): void;
32
+ export interface TierFact {
33
+ /** Human-readable size, e.g. "5KB". */
34
+ kb: string;
35
+ /** Human-readable token estimate, e.g. "1.2K tokens" or "320 tokens". */
36
+ tokens: string;
37
+ }
38
+ /**
39
+ * Single source of truth for the survival/working tier size facts.
40
+ *
41
+ * These numbers are advertised in the tool spec, the index output, and the
42
+ * README. Deriving them from the actual files (instead of hand-syncing literals
43
+ * in four places) is what stops them drifting stale — the recurring bug this
44
+ * helper exists to kill. Estimate ratio matches the tool spec: ~250 tokens/KB.
45
+ */
46
+ export declare function getTierFacts(docsPath: string): {
47
+ survival: TierFact;
48
+ working: TierFact;
49
+ };
27
50
  /**
28
51
  * Get list of topics that apply to a given file path based on applyTo patterns
29
52
  */
@@ -45,6 +45,31 @@ function cachedReadFile(filePath) {
45
45
  _fileCache.set(filePath, content);
46
46
  return content;
47
47
  }
48
+ /**
49
+ * Single source of truth for the survival/working tier size facts.
50
+ *
51
+ * These numbers are advertised in the tool spec, the index output, and the
52
+ * README. Deriving them from the actual files (instead of hand-syncing literals
53
+ * in four places) is what stops them drifting stale — the recurring bug this
54
+ * helper exists to kill. Estimate ratio matches the tool spec: ~250 tokens/KB.
55
+ */
56
+ export function getTierFacts(docsPath) {
57
+ const fact = (file) => {
58
+ let size = 0;
59
+ try {
60
+ size = cachedReadFile(join(docsPath, file)).length;
61
+ }
62
+ catch {
63
+ size = 0;
64
+ }
65
+ const estTokens = size / 4;
66
+ const tokens = estTokens >= 1000
67
+ ? `${(estTokens / 1000).toFixed(1)}K tokens`
68
+ : `${Math.ceil(estTokens)} tokens`;
69
+ return { kb: `${Math.round(size / 1024)}KB`, tokens };
70
+ };
71
+ return { survival: fact("survival.md"), working: fact("working.md") };
72
+ }
48
73
  // =============================================================================
49
74
  // Core Functions
50
75
  // =============================================================================
@@ -118,6 +143,46 @@ export function getXanoscriptDocsVersion(docsPath) {
118
143
  return "unknown";
119
144
  }
120
145
  }
146
+ /**
147
+ * Resolve the ordered, budget-bounded topic list for a file_path query.
148
+ *
149
+ * Shared by readXanoscriptDocsV2 and readXanoscriptDocsStructured so the
150
+ * exclude -> priority-sort -> token-budget -> empty-check logic stays identical
151
+ * across the string and structured response paths. It previously lived as two
152
+ * byte-for-byte copies that could silently diverge.
153
+ */
154
+ function selectTopicsForFilePath(docsPath, args, mode) {
155
+ let topics = getDocsForFilePath(args.file_path);
156
+ // Filter out excluded topics
157
+ if (args.exclude_topics && args.exclude_topics.length > 0) {
158
+ topics = topics.filter((t) => !args.exclude_topics.includes(t));
159
+ }
160
+ // Budget-aware loading: sort by priority and stop when budget is exceeded
161
+ if (args.max_tokens) {
162
+ let tokenBudget = args.max_tokens;
163
+ const sortedTopics = [...topics].sort((a, b) => {
164
+ const pa = XANOSCRIPT_DOCS_V2[a]?.priority ?? 99;
165
+ const pb = XANOSCRIPT_DOCS_V2[b]?.priority ?? 99;
166
+ return pa - pb;
167
+ });
168
+ const filteredTopics = [];
169
+ for (const t of sortedTopics) {
170
+ const config = XANOSCRIPT_DOCS_V2[t];
171
+ const content = cachedReadFile(join(docsPath, config.file));
172
+ const topicContent = mode === "quick_reference" ? extractQuickReference(content, t) : content;
173
+ const estimatedTokens = Math.ceil(topicContent.length / 4);
174
+ if (tokenBudget - estimatedTokens < 0 && filteredTopics.length > 0)
175
+ break;
176
+ filteredTopics.push(t);
177
+ tokenBudget -= estimatedTokens;
178
+ }
179
+ topics = filteredTopics;
180
+ }
181
+ if (topics.length === 0) {
182
+ throw new Error(`No documentation found for file pattern: ${args.file_path}\n\nAvailable topics: ${Object.keys(XANOSCRIPT_DOCS_V2).join(", ")}`);
183
+ }
184
+ return topics;
185
+ }
121
186
  /**
122
187
  * Read XanoScript documentation with v2 structure
123
188
  */
@@ -129,9 +194,17 @@ export function readXanoscriptDocsV2(docsPath, args) {
129
194
  const content = cachedReadFile(join(docsPath, tierFile));
130
195
  return `${content}\n\n---\nDocumentation version: ${version}`;
131
196
  }
132
- // Index mode: return compact topic listing with byte sizes and token estimates
133
- if (args?.mode === "index") {
134
- const rows = Object.entries(XANOSCRIPT_DOCS_V2).map(([name, config]) => {
197
+ // Index mode — also the default when no topic/file_path is given.
198
+ // Returns a compact topic listing with byte sizes and token estimates plus
199
+ // orientation pointers, so a bare discovery call costs ~4KB instead of the
200
+ // full README. The README is still reachable via topic='readme'.
201
+ if (args?.mode === "index" || (!args?.topic && !args?.file_path)) {
202
+ // survival/working are whole-corpus digests reached via tier=, not granular
203
+ // topic= targets — listing them as table rows invites topic='survival' calls
204
+ // (a different, non-tier code path). They are surfaced in Next steps instead.
205
+ const rows = Object.entries(XANOSCRIPT_DOCS_V2)
206
+ .filter(([name]) => name !== "survival" && name !== "working")
207
+ .map(([name, config]) => {
135
208
  let size;
136
209
  try {
137
210
  size = cachedReadFile(join(docsPath, config.file)).length;
@@ -143,59 +216,37 @@ export function readXanoscriptDocsV2(docsPath, args) {
143
216
  const estTokens = Math.ceil(size / 4);
144
217
  return `| ${name} | ${config.description} | ${sizeKb} KB | ~${estTokens} |`;
145
218
  });
219
+ const tiers = getTierFacts(docsPath);
146
220
  return [
147
221
  `# XanoScript Documentation Index`,
148
222
  ``,
149
- `Version: ${version}`,
223
+ `XanoScript is the declarative language for Xano backends (tables, APIs, functions, tasks, AI agents).`,
224
+ ``,
150
225
  `Topics: ${rows.length}`,
151
226
  ``,
152
227
  `| Topic | Description | Size | Est. Tokens |`,
153
228
  `|-------|-------------|------|-------------|`,
154
229
  ...rows,
155
230
  ``,
156
- `Use topic='<name>' to load a specific topic. Use mode='quick_reference' for compact output.`,
157
- `Use tier='survival' (~800 tokens) or tier='working' (~3500 tokens) for context-limited models.`,
231
+ `Next steps:`,
232
+ `- topic='readme' — full overview (workspace structure, core syntax patterns, type names)`,
233
+ `- topic='<name>' — load one topic (e.g. 'syntax', 'database', 'apis')`,
234
+ `- file_path='api/users/create.xs' — auto-select the docs for the file you're editing`,
235
+ `- tier='survival' (~${tiers.survival.tokens}) or tier='working' (~${tiers.working.tokens}) for context-limited models`,
236
+ `- mode='quick_reference' — compact output when you only need a reminder`,
237
+ `- max_tokens=4000 with file_path= — stop loading once the budget is reached`,
238
+ `- exclude_topics=['syntax'] with file_path= — skip topics you've already loaded`,
239
+ ``,
240
+ `---`,
241
+ `Documentation version: ${version}`,
158
242
  ].join("\n");
159
243
  }
160
244
  // Default to quick_reference for file_path mode (loads many topics),
161
245
  // full for topic mode (loads single topic)
162
246
  const mode = args?.mode || (args?.file_path ? "quick_reference" : "full");
163
- // Default: return README
164
- if (!args?.topic && !args?.file_path) {
165
- const readme = cachedReadFile(join(docsPath, "README.md"));
166
- return `${readme}\n\n---\nDocumentation version: ${version}`;
167
- }
168
247
  // Context-aware: return docs matching file pattern
169
248
  if (args?.file_path) {
170
- let topics = getDocsForFilePath(args.file_path);
171
- // Filter out excluded topics
172
- if (args.exclude_topics && args.exclude_topics.length > 0) {
173
- topics = topics.filter((t) => !args.exclude_topics.includes(t));
174
- }
175
- // Budget-aware loading: sort by priority and stop when budget is exceeded
176
- if (args.max_tokens) {
177
- let tokenBudget = args.max_tokens;
178
- const sortedTopics = [...topics].sort((a, b) => {
179
- const pa = XANOSCRIPT_DOCS_V2[a]?.priority ?? 99;
180
- const pb = XANOSCRIPT_DOCS_V2[b]?.priority ?? 99;
181
- return pa - pb;
182
- });
183
- const filteredTopics = [];
184
- for (const t of sortedTopics) {
185
- const config = XANOSCRIPT_DOCS_V2[t];
186
- const content = cachedReadFile(join(docsPath, config.file));
187
- const topicContent = mode === "quick_reference" ? extractQuickReference(content, t) : content;
188
- const estimatedTokens = Math.ceil(topicContent.length / 4);
189
- if (tokenBudget - estimatedTokens < 0 && filteredTopics.length > 0)
190
- break;
191
- filteredTopics.push(t);
192
- tokenBudget -= estimatedTokens;
193
- }
194
- topics = filteredTopics;
195
- }
196
- if (topics.length === 0) {
197
- throw new Error(`No documentation found for file pattern: ${args.file_path}\n\nAvailable topics: ${Object.keys(XANOSCRIPT_DOCS_V2).join(", ")}`);
198
- }
249
+ const topics = selectTopicsForFilePath(docsPath, args, mode);
199
250
  const docs = topics.map((t) => {
200
251
  const config = XANOSCRIPT_DOCS_V2[t];
201
252
  const content = cachedReadFile(join(docsPath, config.file));
@@ -224,34 +275,7 @@ export function readXanoscriptDocsV2(docsPath, args) {
224
275
  */
225
276
  export function readXanoscriptDocsStructured(docsPath, args) {
226
277
  const mode = args.mode || "quick_reference";
227
- let topics = getDocsForFilePath(args.file_path);
228
- if (args.exclude_topics && args.exclude_topics.length > 0) {
229
- topics = topics.filter((t) => !args.exclude_topics.includes(t));
230
- }
231
- // Budget-aware loading
232
- if (args.max_tokens) {
233
- let tokenBudget = args.max_tokens;
234
- const sortedTopics = [...topics].sort((a, b) => {
235
- const pa = XANOSCRIPT_DOCS_V2[a]?.priority ?? 99;
236
- const pb = XANOSCRIPT_DOCS_V2[b]?.priority ?? 99;
237
- return pa - pb;
238
- });
239
- const filteredTopics = [];
240
- for (const t of sortedTopics) {
241
- const config = XANOSCRIPT_DOCS_V2[t];
242
- const content = cachedReadFile(join(docsPath, config.file));
243
- const topicContent = mode === "quick_reference" ? extractQuickReference(content, t) : content;
244
- const estimatedTokens = Math.ceil(topicContent.length / 4);
245
- if (tokenBudget - estimatedTokens < 0 && filteredTopics.length > 0)
246
- break;
247
- filteredTopics.push(t);
248
- tokenBudget -= estimatedTokens;
249
- }
250
- topics = filteredTopics;
251
- }
252
- if (topics.length === 0) {
253
- throw new Error(`No documentation found for file pattern: ${args.file_path}\n\nAvailable topics: ${Object.keys(XANOSCRIPT_DOCS_V2).join(", ")}`);
254
- }
278
+ const topics = selectTopicsForFilePath(docsPath, args, mode);
255
279
  return topics.map((t) => {
256
280
  const config = XANOSCRIPT_DOCS_V2[t];
257
281
  const content = cachedReadFile(join(docsPath, config.file));
@@ -120,7 +120,7 @@ $db.table.field // Database field reference (in queries)
120
120
  $this // Current item in loops/maps
121
121
  ```
122
122
 
123
- **Reserved Variables:** The following cannot be used as variable names: `$response`, `$output`, `$input`, `$auth`, `$env`, `$db`, `$this`, `$result`, `$index`. See `xano_xano_xanoscript_docs({ topic: "essentials" })` for detailed variable access rules.
123
+ **Reserved Variables:** The following cannot be used as variable names: `$response`, `$output`, `$input`, `$auth`, `$env`, `$db`, `$this`, `$result`, `$index`. See `xano_xanoscript_docs({ topic: "essentials" })` for detailed variable access rules.
124
124
 
125
125
  ### Type Names
126
126
 
@@ -203,10 +203,12 @@ Use `xano_xanoscript_docs({ topic: "<topic>" })` to retrieve documentation.
203
203
 
204
204
  ### Tiers (for context-limited models)
205
205
 
206
+ Approximate sizes below; the tool reports exact live sizes in the `mode: "index"` listing and derives the advertised token counts from the actual files at runtime.
207
+
206
208
  | Topic | Description | Size |
207
209
  | ---------- | ------------------------------------------------------------ | ---- |
208
- | `survival` | Minimal syntax survival kit for models with <16K context | ~3KB (~800 tokens) |
209
- | `working` | Complete working reference for models with 16-64K context | ~12KB (~3500 tokens) |
210
+ | `survival` | Minimal syntax survival kit for models with <16K context | ~5KB (~1.2K tokens) |
211
+ | `working` | Complete working reference for models with 16-64K context | ~17KB (~4.4K tokens) |
210
212
 
211
213
  Use `xano_xanoscript_docs({ tier: "survival" })` or `xano_xanoscript_docs({ tier: "working" })`.
212
214
 
@@ -1,19 +1,19 @@
1
1
  {
2
- "version": "1.0.0",
3
- "description": "Machine-readable index for XanoScript documentation",
2
+ "version": "2.2.0",
3
+ "description": "Machine-readable index for XanoScript documentation (version mirrors version.json)",
4
4
 
5
5
  "topics": {
6
6
  "survival": {
7
7
  "file": "survival.md",
8
- "description": "Minimal syntax survival kit for writing valid XanoScript (~3KB)",
9
- "applyTo": ["**/*.xs"],
8
+ "description": "Minimal syntax survival kit for writing valid XanoScript",
9
+ "applyTo": [],
10
10
  "priority": 0,
11
11
  "aliases": ["minimal", "tiny", "nano", "small"]
12
12
  },
13
13
  "working": {
14
14
  "file": "working.md",
15
- "description": "Complete working reference for common XanoScript tasks (~12KB)",
16
- "applyTo": ["**/*.xs"],
15
+ "description": "Complete working reference for common XanoScript tasks",
16
+ "applyTo": [],
17
17
  "priority": 0,
18
18
  "aliases": ["compact", "reference", "medium"]
19
19
  },
@@ -27,14 +27,14 @@
27
27
  "file": "essentials.md",
28
28
  "description": "Common patterns, quick reference, and common mistakes to avoid",
29
29
  "applyTo": ["**/*.xs"],
30
- "priority": 1,
30
+ "priority": 2,
31
31
  "aliases": ["quick", "common", "basics", "start", "cheatsheet", "quickstart", "patterns", "mistakes"]
32
32
  },
33
33
  "syntax": {
34
34
  "file": "syntax.md",
35
35
  "description": "Expressions, operators, and filters for all XanoScript code",
36
36
  "applyTo": ["**/*.xs"],
37
- "priority": 2,
37
+ "priority": 1,
38
38
  "aliases": ["filters", "operators", "expressions"]
39
39
  },
40
40
  "syntax/string-filters": {
@@ -59,42 +59,42 @@
59
59
  "file": "types.md",
60
60
  "description": "Data types, input blocks, and validation",
61
61
  "applyTo": ["function/**/*.xs", "api/**/*.xs", "ai/tool/*.xs", "ai/agent/*.xs"],
62
- "priority": 4,
62
+ "priority": 5,
63
63
  "aliases": ["validation", "input", "data-types"]
64
64
  },
65
65
  "tables": {
66
66
  "file": "tables.md",
67
67
  "description": "Database schema definitions with indexes and relationships",
68
68
  "applyTo": ["table/*.xs"],
69
- "priority": 8,
69
+ "priority": 3,
70
70
  "aliases": ["schema", "fields", "indexes"]
71
71
  },
72
72
  "functions": {
73
73
  "file": "functions.md",
74
74
  "description": "Reusable function stacks with inputs and responses",
75
75
  "applyTo": ["function/**/*.xs"],
76
- "priority": 6,
76
+ "priority": 3,
77
77
  "aliases": ["fn", "reusable", "stack"]
78
78
  },
79
79
  "apis": {
80
80
  "file": "apis.md",
81
81
  "description": "HTTP endpoint definitions with authentication and CRUD patterns",
82
82
  "applyTo": ["api/**/*.xs"],
83
- "priority": 7,
83
+ "priority": 3,
84
84
  "aliases": ["endpoints", "http", "rest", "query"]
85
85
  },
86
86
  "tasks": {
87
87
  "file": "tasks.md",
88
88
  "description": "Scheduled and cron jobs",
89
89
  "applyTo": ["task/*.xs"],
90
- "priority": 10,
90
+ "priority": 3,
91
91
  "aliases": ["scheduled", "jobs", "cron"]
92
92
  },
93
93
  "triggers": {
94
94
  "file": "triggers.md",
95
95
  "description": "Event-driven handlers (table, realtime, workspace, agent, MCP)",
96
96
  "applyTo": ["*/trigger/*.xs", "ai/*/trigger/*.xs", "realtime/trigger/*.xs"],
97
- "priority": 10,
97
+ "priority": 3,
98
98
  "aliases": ["events", "hooks", "handlers"]
99
99
  },
100
100
  "database": {
@@ -108,33 +108,35 @@
108
108
  "file": "agents.md",
109
109
  "description": "AI agent configuration with LLM providers and tools",
110
110
  "applyTo": ["ai/agent/*.xs"],
111
- "priority": 12,
111
+ "priority": 3,
112
112
  "aliases": ["ai", "llm", "chatbot"]
113
113
  },
114
114
  "tools": {
115
115
  "file": "tools.md",
116
116
  "description": "AI tools for agents and MCP servers",
117
117
  "applyTo": ["ai/tool/*.xs"],
118
- "priority": 12,
118
+ "priority": 3,
119
119
  "aliases": ["ai-tools", "agent-tools"]
120
120
  },
121
121
  "mcp-servers": {
122
122
  "file": "mcp-servers.md",
123
123
  "description": "MCP server definitions exposing tools",
124
124
  "applyTo": ["ai/mcp_server/*.xs"],
125
- "priority": 15,
125
+ "priority": 3,
126
126
  "aliases": ["mcp", "model-context-protocol"]
127
127
  },
128
128
  "unit-testing": {
129
129
  "file": "unit-testing.md",
130
130
  "description": "Unit tests, mocks, and assertions within functions, APIs, and middleware",
131
131
  "applyTo": ["function/**/*.xs", "api/**/*.xs", "middleware/*.xs"],
132
+ "priority": 7,
132
133
  "aliases": ["tests", "unit-tests", "mocks", "assertions"]
133
134
  },
134
135
  "workflow-tests": {
135
136
  "file": "workflow-tests.md",
136
137
  "description": "End-to-end workflow tests with data source selection and tags",
137
138
  "applyTo": ["workflow_test/*.xs"],
139
+ "priority": 3,
138
140
  "aliases": ["e2e", "workflow", "integration-tests"]
139
141
  },
140
142
  "integrations": {
@@ -177,36 +179,42 @@
177
179
  "file": "frontend.md",
178
180
  "description": "Static frontend development and deployment",
179
181
  "applyTo": ["static/**/*"],
182
+ "priority": 3,
180
183
  "aliases": ["static", "html", "css", "web"]
181
184
  },
182
185
  "addons": {
183
186
  "file": "addons.md",
184
187
  "description": "Reusable subqueries for fetching related data",
185
188
  "applyTo": ["addon/*.xs"],
189
+ "priority": 3,
186
190
  "aliases": ["subqueries", "relations"]
187
191
  },
188
192
  "debugging": {
189
193
  "file": "debugging.md",
190
194
  "description": "Logging, inspecting, and debugging XanoScript execution",
191
195
  "applyTo": ["**/*.xs"],
196
+ "priority": 8,
192
197
  "aliases": ["logs", "debug", "trace"]
193
198
  },
194
199
  "performance": {
195
200
  "file": "performance.md",
196
201
  "description": "Performance optimization best practices",
197
202
  "applyTo": ["function/**/*.xs", "api/**/*.xs"],
203
+ "priority": 7,
198
204
  "aliases": ["optimization", "speed", "caching"]
199
205
  },
200
206
  "realtime": {
201
207
  "file": "realtime.md",
202
208
  "description": "Real-time channels and events for push updates",
203
209
  "applyTo": ["realtime/channel/*.xs", "realtime/trigger/*.xs"],
210
+ "priority": 3,
204
211
  "aliases": ["websocket", "channels", "pubsub"]
205
212
  },
206
213
  "security": {
207
214
  "file": "security.md",
208
215
  "description": "Security best practices for authentication and authorization",
209
216
  "applyTo": ["function/**/*.xs", "api/**/*.xs"],
217
+ "priority": 6,
210
218
  "aliases": ["auth", "authorization", "permissions"]
211
219
  },
212
220
  "streaming": {
@@ -219,18 +227,21 @@
219
227
  "file": "middleware.md",
220
228
  "description": "Request/response interceptors for functions, queries, tasks, and tools",
221
229
  "applyTo": ["middleware/*.xs"],
230
+ "priority": 3,
222
231
  "aliases": ["interceptors", "hooks"]
223
232
  },
224
233
  "branch": {
225
234
  "file": "branch.md",
226
235
  "description": "Branch-level settings: middleware, history retention, visual styling",
227
236
  "applyTo": ["branch.xs"],
237
+ "priority": 3,
228
238
  "aliases": ["settings", "config"]
229
239
  },
230
240
  "workspace": {
231
241
  "file": "workspace.md",
232
242
  "description": "Workspace-level settings: environment variables, preferences, realtime",
233
243
  "applyTo": ["workspace/**/*.xs"],
244
+ "priority": 3,
234
245
  "aliases": ["env", "environment", "preferences"]
235
246
  }
236
247
  },
@@ -82,6 +82,8 @@ input {
82
82
 
83
83
  ## Tool-Specific Statements
84
84
 
85
+ > **Where these belong:** `api.call`, `task.call`, and `tool.call` are for **tools**. Use them to compose a tool from other Xano constructs. Don't reach for them in API endpoints, functions, or tasks. (To call a function from a regular stack, use `function.run`.)
86
+
85
87
  ### api.call
86
88
  Call an API endpoint:
87
89
 
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "2.1.1",
2
+ "version": "2.2.0",
3
3
  "updated": "2026-06-01"
4
4
  }
@@ -28,6 +28,8 @@ workflow_test "<name>" {
28
28
 
29
29
  Call functions invoke Xano constructs and capture their results. Each returns a result that can be stored with `as $variable`.
30
30
 
31
+ > **Where these belong:** Call functions are for **workflow tests**. Don't reach for them in API endpoints, functions, or tasks. (To call a function from a regular stack, use `function.run` — see the [`function.call`](#functioncall) note below.)
32
+
31
33
  | Call Function | Description | Required Properties |
32
34
  | ----------------- | ------------------------------ | ------------------------------------ |
33
35
  | `api.call` | Call an API endpoint | `api_group`, `verb` (on call), optional `headers` |
@@ -656,7 +656,7 @@ var $msg { value = ($status|to_text) ~ ": " ~ ($data|json_encode) }
656
656
  | `agents` | AI agent configuration | ~9KB |
657
657
  | `tools` | AI tools for agents | ~7KB |
658
658
  | `mcp-servers` | MCP server definitions | ~4KB |
659
- | `security` | Auth patterns, encryption | ~12KB |
659
+ | `security` | Auth patterns, encryption | ~8KB |
660
660
  | `integrations` | External APIs, cloud storage, Redis | ~varies |
661
661
  | `unit-testing` | Unit tests, mocks, assertions | ~10KB |
662
662
  | `workflow-tests` | E2E workflow tests | ~11KB |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/developer-mcp",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "MCP server and library for Xano development - XanoScript validation, Meta API, Run API, and CLI documentation",
5
5
  "type": "module",
6
6
  "main": "dist/lib.js",