@xano/developer-mcp 1.0.56 → 1.0.57

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
@@ -208,6 +208,9 @@ const apiDocs = xanoscriptDocs({ file_path: 'api/users/create_post.xs' });
208
208
 
209
209
  // Get compact quick reference
210
210
  const quickRef = xanoscriptDocs({ topic: 'database', mode: 'quick_reference' });
211
+
212
+ // Get topic index with sizes
213
+ const index = xanoscriptDocs({ mode: 'index' });
211
214
  ```
212
215
 
213
216
  ### Get Meta API Documentation
@@ -335,16 +338,19 @@ Retrieves XanoScript programming language documentation with context-aware suppo
335
338
  |-----------|------|----------|-------------|
336
339
  | `topic` | string | No | Specific documentation topic to retrieve |
337
340
  | `file_path` | string | No | File path being edited for context-aware docs (e.g., `api/users/create_post.xs`) |
338
- | `mode` | string | No | `full` (default) or `quick_reference` for compact syntax cheatsheet |
341
+ | `mode` | string | No | `full` (default), `quick_reference` for compact syntax reference, or `index` for topic listing with sizes |
342
+ | `exclude_topics` | string[] | No | Topic names to exclude from `file_path` results (e.g., topics already loaded) |
339
343
 
340
344
  **Available Topics:**
341
345
 
342
346
  | Topic | Description |
343
347
  |-------|-------------|
344
348
  | `readme` | XanoScript overview, workspace structure, and quick reference |
345
- | `cheatsheet` | Quick reference for 20 most common XanoScript patterns (recommended first stop) |
349
+ | `essentials` | Common patterns, quick reference, and common mistakes to avoid |
346
350
  | `syntax` | Expressions, operators, and filters for all XanoScript code |
347
- | `quickstart` | Common patterns, quick reference, and common mistakes to avoid |
351
+ | `syntax/string-filters` | String filters, regex, encoding, security filters, text functions |
352
+ | `syntax/array-filters` | Array filters, functional operations, and array functions |
353
+ | `syntax/functions` | Math filters/functions, object functions, bitwise operations |
348
354
  | `types` | Data types, input blocks, and validation |
349
355
  | `tables` | Database schema definitions with indexes and relationships |
350
356
  | `functions` | Reusable function stacks with inputs and responses |
@@ -381,15 +387,21 @@ Retrieves XanoScript programming language documentation with context-aware suppo
381
387
  // Get overview
382
388
  xanoscript_docs()
383
389
 
384
- // Get quick reference cheatsheet (recommended first stop)
385
- xanoscript_docs({ topic: "cheatsheet" })
390
+ // Get essentials (recommended first stop)
391
+ xanoscript_docs({ topic: "essentials" })
386
392
 
387
393
  // Get specific topic
388
394
  xanoscript_docs({ topic: "functions" })
389
395
 
396
+ // Discover available topics with sizes
397
+ xanoscript_docs({ mode: "index" })
398
+
390
399
  // Context-aware: get all docs relevant to file being edited
391
400
  xanoscript_docs({ file_path: "api/users/create_post.xs" })
392
401
 
402
+ // Context-aware with exclusions (skip already-loaded topics)
403
+ xanoscript_docs({ file_path: "api/users/create_post.xs", exclude_topics: ["syntax", "essentials"] })
404
+
393
405
  // Compact quick reference (uses less context)
394
406
  xanoscript_docs({ topic: "database", mode: "quick_reference" })
395
407
  ```
@@ -505,9 +517,11 @@ The server also exposes XanoScript documentation as MCP resources for direct acc
505
517
  | Resource URI | Description |
506
518
  |--------------|-------------|
507
519
  | `xanoscript://docs/readme` | Overview and quick reference |
508
- | `xanoscript://docs/cheatsheet` | Quick reference for 20 most common patterns |
520
+ | `xanoscript://docs/essentials` | Common patterns, quick reference, and common mistakes to avoid |
509
521
  | `xanoscript://docs/syntax` | Expressions, operators, and filters |
510
- | `xanoscript://docs/quickstart` | Common patterns and common mistakes to avoid |
522
+ | `xanoscript://docs/syntax/string-filters` | String filters, regex, encoding, security filters |
523
+ | `xanoscript://docs/syntax/array-filters` | Array filters, functional operations |
524
+ | `xanoscript://docs/syntax/functions` | Math filters/functions, object functions, bitwise |
511
525
  | `xanoscript://docs/types` | Data types and validation |
512
526
  | `xanoscript://docs/tables` | Database schema definitions |
513
527
  | `xanoscript://docs/functions` | Reusable function stacks |
@@ -561,10 +575,12 @@ xano-developer-mcp/
561
575
  │ ├── xanoscript.test.ts # Tests for xanoscript module
562
576
  │ ├── xanoscript-language-server.d.ts # TypeScript declarations
563
577
  │ ├── tools/ # Standalone tool modules
564
- │ │ ├── index.ts # Unified tool exports
578
+ │ │ ├── index.ts # Unified tool exports & handler
579
+ │ │ ├── index.test.ts # Tests for tool handler
565
580
  │ │ ├── types.ts # Common types (ToolResult)
566
581
  │ │ ├── validate_xanoscript.ts # XanoScript validation tool
567
582
  │ │ ├── xanoscript_docs.ts # XanoScript docs tool
583
+ │ │ ├── xanoscript_docs.test.ts # Tests for xanoscript docs tool
568
584
  │ │ ├── mcp_version.ts # Version tool
569
585
  │ │ ├── meta_api_docs.ts # Meta API docs tool wrapper
570
586
  │ │ └── cli_docs.ts # CLI docs tool wrapper
@@ -582,9 +598,15 @@ xano-developer-mcp/
582
598
  │ │ ├── format.ts # Documentation formatter
583
599
  │ │ └── topics/ # Individual topic modules
584
600
  │ └── xanoscript_docs/ # XanoScript language documentation
601
+ │ ├── docs_index.json # Machine-readable topic registry
585
602
  │ ├── version.json
586
603
  │ ├── README.md
604
+ │ ├── essentials.md
587
605
  │ ├── syntax.md
606
+ │ ├── syntax/ # Syntax sub-topics
607
+ │ │ ├── string-filters.md
608
+ │ │ ├── array-filters.md
609
+ │ │ └── functions.md
588
610
  │ └── ...
589
611
  ├── dist/ # Compiled JavaScript output
590
612
  ├── vitest.config.ts # Test configuration
@@ -651,10 +673,12 @@ Compiles TypeScript to JavaScript in the `dist/` directory.
651
673
 
652
674
  **XanoScript Documentation** (`src/xanoscript_docs/`):
653
675
  - Markdown files for XanoScript language reference
654
- - Configured in `src/index.ts` via `XANOSCRIPT_DOCS_V2` with:
676
+ - Configured in `src/xanoscript_docs/docs_index.json` with:
655
677
  - **file**: The markdown file containing the documentation
656
- - **applyTo**: Glob patterns for context-aware matching (e.g., `api/**/*.xs`)
678
+ - **applyTo**: Glob patterns for context-aware matching (e.g., `apis/**/*.xs`)
657
679
  - **description**: Human-readable description of the topic
680
+ - **aliases**: Alternative names for topic lookup
681
+ - **priority**: Ordering weight for file_path matching
658
682
 
659
683
  **Meta API Documentation** (`src/meta_api_docs/`):
660
684
  - TypeScript modules with structured documentation
@@ -683,6 +707,8 @@ npm run test:coverage
683
707
  | Module | Test File | Description |
684
708
  |--------|-----------|-------------|
685
709
  | `xanoscript.ts` | `xanoscript.test.ts` | Core XanoScript documentation logic including file path matching and quick reference extraction |
710
+ | `tools/index.ts` | `tools/index.test.ts` | Tool handler dispatch and argument validation |
711
+ | `tools/xanoscript_docs.ts` | `tools/xanoscript_docs.test.ts` | XanoScript documentation tool and path resolution |
686
712
  | `meta_api_docs/index.ts` | `meta_api_docs/index.test.ts` | Meta API documentation handler and topic management |
687
713
  | `meta_api_docs/format.ts` | `meta_api_docs/format.test.ts` | Documentation formatting for endpoints, examples, and patterns |
688
714
  | `meta_api_docs/types.ts` | `meta_api_docs/types.test.ts` | Type structure validation |
@@ -695,6 +721,12 @@ Tests are co-located with source files using the `.test.ts` suffix:
695
721
  src/
696
722
  ├── xanoscript.ts
697
723
  ├── xanoscript.test.ts # Tests for xanoscript.ts
724
+ ├── tools/
725
+ │ ├── index.ts
726
+ │ ├── index.test.ts # Tests for tool handler
727
+ │ ├── xanoscript_docs.ts
728
+ │ ├── xanoscript_docs.test.ts # Tests for xanoscript docs tool
729
+ │ └── ...
698
730
  ├── meta_api_docs/
699
731
  │ ├── index.ts
700
732
  │ ├── index.test.ts # Tests for index.ts
@@ -50,4 +50,14 @@ export declare const cliDocsToolDefinition: {
50
50
  };
51
51
  required: string[];
52
52
  };
53
+ outputSchema: {
54
+ type: string;
55
+ properties: {
56
+ documentation: {
57
+ type: string;
58
+ description: string;
59
+ };
60
+ };
61
+ required: string[];
62
+ };
53
63
  };
@@ -96,4 +96,14 @@ ${getTopicDescriptions()}
96
96
  },
97
97
  required: ["topic"],
98
98
  },
99
+ outputSchema: {
100
+ type: "object",
101
+ properties: {
102
+ documentation: {
103
+ type: "string",
104
+ description: "The CLI documentation content for the requested topic.",
105
+ },
106
+ },
107
+ required: ["documentation"],
108
+ },
99
109
  };
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { readFileSync } from "fs";
14
14
  import { fileURLToPath } from "url";
15
15
  import { dirname, join } from "path";
16
16
  import { XANOSCRIPT_DOCS_V2, getXanoscriptDocsVersion } from "./xanoscript.js";
17
- import { toolDefinitions, handleTool, toMcpResponse, } from "./tools/index.js";
17
+ import { toolDefinitions, handleTool, toMcpResponse, getXanoscriptDocsPath, } from "./tools/index.js";
18
18
  const __filename = fileURLToPath(import.meta.url);
19
19
  const __dirname = dirname(__filename);
20
20
  const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
@@ -24,24 +24,8 @@ if (process.argv.includes("--version") || process.argv.includes("-v")) {
24
24
  process.exit(0);
25
25
  }
26
26
  // =============================================================================
27
- // Path Resolution
27
+ // Path Resolution (uses shared path from tools/xanoscript_docs.ts)
28
28
  // =============================================================================
29
- function getXanoscriptDocsPath() {
30
- const possiblePaths = [
31
- join(__dirname, "xanoscript_docs"), // dist/xanoscript_docs (production)
32
- join(__dirname, "..", "src", "xanoscript_docs"), // src/xanoscript_docs (dev before build)
33
- ];
34
- for (const p of possiblePaths) {
35
- try {
36
- readFileSync(join(p, "version.json"));
37
- return p;
38
- }
39
- catch {
40
- continue;
41
- }
42
- }
43
- return join(__dirname, "xanoscript_docs");
44
- }
45
29
  const XANOSCRIPT_DOCS_PATH = getXanoscriptDocsPath();
46
30
  // =============================================================================
47
31
  // MCP Server Setup
package/dist/lib.d.ts CHANGED
@@ -42,10 +42,10 @@
42
42
  * @packageDocumentation
43
43
  */
44
44
  export { validateXanoscript, type ValidateXanoscriptArgs, type ValidationResult, type ParserDiagnostic, } from "./tools/validate_xanoscript.js";
45
- export { xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, } from "./tools/xanoscript_docs.js";
45
+ export { xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, type TopicDoc, } from "./tools/xanoscript_docs.js";
46
46
  export { mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, } from "./tools/mcp_version.js";
47
47
  export { metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, } from "./tools/meta_api_docs.js";
48
48
  export { cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, } from "./tools/cli_docs.js";
49
49
  export { type ToolResult, toMcpResponse } from "./tools/types.js";
50
- export { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, getDocsForFilePath, extractQuickReference, getXanoscriptDocsVersion, getTopicNames as getXanoscriptTopicNames, getTopicDescriptions as getXanoscriptTopicDescriptions, type DocConfig, } from "./xanoscript.js";
50
+ export { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, readXanoscriptDocsStructured, getDocsForFilePath, extractQuickReference, getXanoscriptDocsVersion, clearDocsCache, getTopicNames as getXanoscriptTopicNames, getTopicDescriptions as getXanoscriptTopicDescriptions, type DocConfig, } from "./xanoscript.js";
51
51
  export { toolDefinitions, handleTool, validateXanoscriptToolDefinition, xanoscriptDocsToolDefinition, mcpVersionToolDefinition, metaApiDocsToolDefinition, cliDocsToolDefinition, } from "./tools/index.js";
package/dist/lib.js CHANGED
@@ -61,7 +61,7 @@ export { toMcpResponse } from "./tools/types.js";
61
61
  // =============================================================================
62
62
  // XanoScript Core Exports (for advanced usage)
63
63
  // =============================================================================
64
- export { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, getDocsForFilePath, extractQuickReference, getXanoscriptDocsVersion, getTopicNames as getXanoscriptTopicNames, getTopicDescriptions as getXanoscriptTopicDescriptions, } from "./xanoscript.js";
64
+ export { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, readXanoscriptDocsStructured, getDocsForFilePath, extractQuickReference, getXanoscriptDocsVersion, clearDocsCache, getTopicNames as getXanoscriptTopicNames, getTopicDescriptions as getXanoscriptTopicDescriptions, } from "./xanoscript.js";
65
65
  // =============================================================================
66
66
  // MCP Tool Definitions (for building custom MCP servers)
67
67
  // =============================================================================
@@ -55,4 +55,14 @@ export declare const metaApiDocsToolDefinition: {
55
55
  };
56
56
  required: string[];
57
57
  };
58
+ outputSchema: {
59
+ type: string;
60
+ properties: {
61
+ documentation: {
62
+ type: string;
63
+ description: string;
64
+ };
65
+ };
66
+ required: string[];
67
+ };
58
68
  };
@@ -121,4 +121,14 @@ ${getTopicDescriptions()}
121
121
  },
122
122
  required: ["topic"],
123
123
  },
124
+ outputSchema: {
125
+ type: "object",
126
+ properties: {
127
+ documentation: {
128
+ type: "string",
129
+ description: "The Meta API documentation content for the requested topic.",
130
+ },
131
+ },
132
+ required: ["documentation"],
133
+ },
124
134
  };
@@ -54,6 +54,7 @@ export function cliDocsTool(args) {
54
54
  return {
55
55
  success: true,
56
56
  data: result.documentation,
57
+ structuredContent: { documentation: result.documentation },
57
58
  };
58
59
  }
59
60
  catch (error) {
@@ -29,18 +29,134 @@
29
29
  * ```
30
30
  */
31
31
  import { validateXanoscript, validateXanoscriptTool, validateXanoscriptToolDefinition, TYPE_ALIASES, RESERVED_VARIABLES, type ValidateXanoscriptArgs, type ValidationResult, type BatchValidationResult, type SingleFileValidationResult, type ParserDiagnostic } from "./validate_xanoscript.js";
32
- import { xanoscriptDocs, xanoscriptDocsTool, xanoscriptDocsToolDefinition, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult } from "./xanoscript_docs.js";
32
+ import { xanoscriptDocs, xanoscriptDocsTool, xanoscriptDocsToolDefinition, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, type TopicDoc } from "./xanoscript_docs.js";
33
33
  import { mcpVersion, mcpVersionTool, mcpVersionToolDefinition, getServerVersion, setServerVersion, type McpVersionResult } from "./mcp_version.js";
34
34
  import { metaApiDocs, metaApiDocsTool, metaApiDocsToolDefinition, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult } from "./meta_api_docs.js";
35
35
  import { cliDocs, cliDocsTool, cliDocsToolDefinition, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult } from "./cli_docs.js";
36
36
  import { type ToolResult, toMcpResponse } from "./types.js";
37
- export { validateXanoscript, TYPE_ALIASES, RESERVED_VARIABLES, type ValidateXanoscriptArgs, type ValidationResult, type BatchValidationResult, type SingleFileValidationResult, type ParserDiagnostic, xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, type ToolResult, toMcpResponse, };
37
+ export { validateXanoscript, TYPE_ALIASES, RESERVED_VARIABLES, type ValidateXanoscriptArgs, type ValidationResult, type BatchValidationResult, type SingleFileValidationResult, type ParserDiagnostic, xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, type TopicDoc, mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, type ToolResult, toMcpResponse, };
38
38
  export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, };
39
39
  export { validateXanoscriptToolDefinition, xanoscriptDocsToolDefinition, mcpVersionToolDefinition, metaApiDocsToolDefinition, cliDocsToolDefinition, };
40
40
  /**
41
41
  * All tool definitions for MCP server registration
42
42
  */
43
43
  export declare const toolDefinitions: ({
44
+ name: string;
45
+ annotations: {
46
+ readOnlyHint: boolean;
47
+ destructiveHint: boolean;
48
+ idempotentHint: boolean;
49
+ openWorldHint: boolean;
50
+ };
51
+ description: string;
52
+ inputSchema: {
53
+ type: string;
54
+ properties: {
55
+ code: {
56
+ type: string;
57
+ description: string;
58
+ };
59
+ file_path: {
60
+ type: string;
61
+ description: string;
62
+ };
63
+ file_paths: {
64
+ type: string;
65
+ items: {
66
+ type: string;
67
+ };
68
+ description: string;
69
+ };
70
+ directory: {
71
+ type: string;
72
+ description: string;
73
+ };
74
+ pattern: {
75
+ type: string;
76
+ description: string;
77
+ };
78
+ };
79
+ required: never[];
80
+ };
81
+ outputSchema: {
82
+ type: string;
83
+ properties: {
84
+ valid: {
85
+ type: string;
86
+ description: string;
87
+ };
88
+ message: {
89
+ type: string;
90
+ description: string;
91
+ };
92
+ };
93
+ required: string[];
94
+ };
95
+ } | {
96
+ name: string;
97
+ description: string;
98
+ annotations: {
99
+ readOnlyHint: boolean;
100
+ destructiveHint: boolean;
101
+ idempotentHint: boolean;
102
+ openWorldHint: boolean;
103
+ };
104
+ inputSchema: {
105
+ type: string;
106
+ properties: {
107
+ topic: {
108
+ type: string;
109
+ enum: string[];
110
+ description: string;
111
+ };
112
+ file_path: {
113
+ type: string;
114
+ description: string;
115
+ };
116
+ mode: {
117
+ type: string;
118
+ enum: string[];
119
+ description: string;
120
+ };
121
+ exclude_topics: {
122
+ type: string;
123
+ items: {
124
+ type: string;
125
+ };
126
+ description: string;
127
+ };
128
+ };
129
+ required: never[];
130
+ };
131
+ outputSchema: {
132
+ type: string;
133
+ properties: {
134
+ documentation: {
135
+ type: string;
136
+ description: string;
137
+ };
138
+ file_path: {
139
+ type: string;
140
+ description: string;
141
+ };
142
+ mode: {
143
+ type: string;
144
+ description: string;
145
+ };
146
+ version: {
147
+ type: string;
148
+ description: string;
149
+ };
150
+ topics: {
151
+ type: string;
152
+ items: {
153
+ type: string;
154
+ };
155
+ description: string;
156
+ };
157
+ };
158
+ };
159
+ } | {
44
160
  name: string;
45
161
  annotations: {
46
162
  readOnlyHint: boolean;
@@ -54,6 +170,16 @@ export declare const toolDefinitions: ({
54
170
  properties: {};
55
171
  required: never[];
56
172
  };
173
+ outputSchema: {
174
+ type: string;
175
+ properties: {
176
+ version: {
177
+ type: string;
178
+ description: string;
179
+ };
180
+ };
181
+ required: string[];
182
+ };
57
183
  } | {
58
184
  name: string;
59
185
  annotations: {
@@ -80,6 +206,16 @@ export declare const toolDefinitions: ({
80
206
  };
81
207
  required: string[];
82
208
  };
209
+ outputSchema: {
210
+ type: string;
211
+ properties: {
212
+ documentation: {
213
+ type: string;
214
+ description: string;
215
+ };
216
+ };
217
+ required: string[];
218
+ };
83
219
  })[];
84
220
  /**
85
221
  * Handle a tool call by name and return the result.
@@ -37,6 +37,7 @@ import { mcpVersion, mcpVersionTool, mcpVersionToolDefinition, getServerVersion,
37
37
  import { metaApiDocs, metaApiDocsTool, metaApiDocsToolDefinition, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, } from "./meta_api_docs.js";
38
38
  import { cliDocs, cliDocsTool, cliDocsToolDefinition, cliTopics, getCliTopicNames, getCliTopicDescriptions, } from "./cli_docs.js";
39
39
  import { toMcpResponse } from "./types.js";
40
+ import { z } from "zod";
40
41
  // =============================================================================
41
42
  // Standalone Tool Functions (for library usage)
42
43
  // =============================================================================
@@ -70,6 +71,41 @@ export const toolDefinitions = [
70
71
  cliDocsToolDefinition,
71
72
  ];
72
73
  // =============================================================================
74
+ // Argument Schemas (Zod validation)
75
+ // =============================================================================
76
+ const validateXanoscriptSchema = z.object({
77
+ code: z.string().optional(),
78
+ file_path: z.string().optional(),
79
+ file_paths: z.array(z.string()).optional(),
80
+ directory: z.string().optional(),
81
+ pattern: z.string().optional(),
82
+ });
83
+ const xanoscriptDocsSchema = z.object({
84
+ topic: z.string().optional(),
85
+ file_path: z.string().optional(),
86
+ mode: z.enum(["full", "quick_reference", "index"]).optional(),
87
+ exclude_topics: z.array(z.string()).optional(),
88
+ });
89
+ const metaApiDocsSchema = z.object({
90
+ topic: z.string(),
91
+ detail_level: z.enum(["overview", "detailed", "examples"]).optional(),
92
+ include_schemas: z.boolean().optional(),
93
+ });
94
+ const cliDocsSchema = z.object({
95
+ topic: z.string(),
96
+ detail_level: z.enum(["overview", "detailed", "examples"]).optional(),
97
+ });
98
+ function parseArgs(schema, args) {
99
+ const result = schema.safeParse(args);
100
+ if (!result.success) {
101
+ const issues = result.error.issues
102
+ .map((i) => `${i.path.join(".")}: ${i.message}`)
103
+ .join("; ");
104
+ return { ok: false, error: { success: false, error: `Invalid arguments: ${issues}` } };
105
+ }
106
+ return { ok: true, data: result.data };
107
+ }
108
+ // =============================================================================
73
109
  // Tool Handler (for MCP server)
74
110
  // =============================================================================
75
111
  /**
@@ -78,16 +114,32 @@ export const toolDefinitions = [
78
114
  */
79
115
  export function handleTool(name, args) {
80
116
  switch (name) {
81
- case "validate_xanoscript":
82
- return validateXanoscriptTool(args);
83
- case "xanoscript_docs":
84
- return xanoscriptDocsTool(args);
117
+ case "validate_xanoscript": {
118
+ const parsed = parseArgs(validateXanoscriptSchema, args);
119
+ if (!parsed.ok)
120
+ return parsed.error;
121
+ return validateXanoscriptTool(parsed.data);
122
+ }
123
+ case "xanoscript_docs": {
124
+ const parsed = parseArgs(xanoscriptDocsSchema, args);
125
+ if (!parsed.ok)
126
+ return parsed.error;
127
+ return xanoscriptDocsTool(parsed.data);
128
+ }
85
129
  case "mcp_version":
86
130
  return mcpVersionTool();
87
- case "meta_api_docs":
88
- return metaApiDocsTool(args);
89
- case "cli_docs":
90
- return cliDocsTool(args);
131
+ case "meta_api_docs": {
132
+ const parsed = parseArgs(metaApiDocsSchema, args);
133
+ if (!parsed.ok)
134
+ return parsed.error;
135
+ return metaApiDocsTool(parsed.data);
136
+ }
137
+ case "cli_docs": {
138
+ const parsed = parseArgs(cliDocsSchema, args);
139
+ if (!parsed.ok)
140
+ return parsed.error;
141
+ return cliDocsTool(parsed.data);
142
+ }
91
143
  default:
92
144
  return {
93
145
  success: false,
@@ -0,0 +1 @@
1
+ export {};