/** * XanoScript Validation Tool * * Validates XanoScript code for syntax errors using the XanoScript language server. * Can be used standalone or within the MCP server. * * Supports multiple input methods: * - code: Raw XanoScript code as a string * - file_path: Path to a single .xs file * - file_paths: Array of file paths for batch validation * - directory: Directory path with optional glob pattern */ import { z } from "zod"; import type { ToolResult } from "./types.js"; /** * Arguments for `validateXanoscript`. Derived from the Zod input shape below * (see `validateXanoscriptToolSpec`) so the runtime parser and the static * type can never drift. */ export type ValidateXanoscriptArgs = z.infer; export declare const SEVERITY: { readonly ERROR: 1; readonly WARNING: 2; }; export type DiagnosticSeverity = (typeof SEVERITY)[keyof typeof SEVERITY]; export interface ParserDiagnostic { severity: DiagnosticSeverity; range: { start: { line: number; character: number; }; end: { line: number; character: number; }; }; message: string; source: string; } export interface SingleFileValidationResult { valid: boolean; errors: ParserDiagnostic[]; message: string; file_path?: string; } export interface ValidationResult { valid: boolean; errors: ParserDiagnostic[]; message: string; } export interface BatchValidationResult { valid: boolean; total_files: number; valid_files: number; invalid_files: number; results: SingleFileValidationResult[]; message: string; } /** * Common type aliases that users might try */ declare const TYPE_ALIASES: Record; /** * Reserved variable names that cannot be used */ declare const RESERVED_VARIABLES: string[]; /** * Validate XanoScript code for syntax errors. * * Supports multiple input methods: * - code: Raw XanoScript code as a string * - file_path: Path to a single .xs file * - file_paths: Array of file paths for batch validation * - directory: Directory path with optional glob pattern * * @param args - The validation arguments * @returns Validation result with errors if any * * @example * ```ts * import { validateXanoscript } from '@xano/developer-mcp'; * * // Validate code directly * const result = validateXanoscript({ code: 'return 1 + 1' }); * * // Validate a single file * const fileResult = validateXanoscript({ file_path: './function/utils.xs' }); * * // Validate multiple files * const batchResult = validateXanoscript({ * file_paths: ['./api/users/get.xs', './api/users/create.xs'] * }); * * // Validate all .xs files in a directory * const dirResult = validateXanoscript({ directory: './src' }); * * // Validate with a specific pattern * const patternResult = validateXanoscript({ * directory: './src', * pattern: 'api/**\/*.xs' * }); * ``` */ export declare function validateXanoscript(args: ValidateXanoscriptArgs): ValidationResult | BatchValidationResult; /** * Validate XanoScript and return a simplified result. * Returns ToolResult format for consistent error handling. */ export declare function validateXanoscriptTool(args: ValidateXanoscriptArgs): ToolResult; export declare const validateXanoscriptToolSpec: import("./define_tool.js").BuiltTool<{ code: z.ZodOptional; file_path: z.ZodOptional; file_paths: z.ZodOptional>; directory: z.ZodOptional; pattern: z.ZodOptional; }, { valid: z.ZodBoolean; message: z.ZodString; warnings: z.ZodOptional; }>; export { TYPE_ALIASES, RESERVED_VARIABLES };