@robinmordasiewicz/f5xc-api-mcp 3.10.0 → 3.12.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/dist/prompts/error-resolution.d.ts +70 -0
- package/dist/prompts/error-resolution.d.ts.map +1 -0
- package/dist/prompts/error-resolution.js +350 -0
- package/dist/prompts/error-resolution.js.map +1 -0
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +2 -0
- package/dist/prompts/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +265 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/discovery/best-practices.d.ts +140 -0
- package/dist/tools/discovery/best-practices.d.ts.map +1 -0
- package/dist/tools/discovery/best-practices.js +499 -0
- package/dist/tools/discovery/best-practices.js.map +1 -0
- package/dist/tools/discovery/cost-estimator.d.ts +114 -0
- package/dist/tools/discovery/cost-estimator.d.ts.map +1 -0
- package/dist/tools/discovery/cost-estimator.js +273 -0
- package/dist/tools/discovery/cost-estimator.js.map +1 -0
- package/dist/tools/discovery/index-loader.d.ts.map +1 -1
- package/dist/tools/discovery/index-loader.js +3 -0
- package/dist/tools/discovery/index-loader.js.map +1 -1
- package/dist/tools/discovery/index.d.ts +145 -0
- package/dist/tools/discovery/index.d.ts.map +1 -1
- package/dist/tools/discovery/index.js +141 -0
- package/dist/tools/discovery/index.js.map +1 -1
- package/dist/tools/discovery/resolver.d.ts +119 -0
- package/dist/tools/discovery/resolver.d.ts.map +1 -0
- package/dist/tools/discovery/resolver.js +369 -0
- package/dist/tools/discovery/resolver.js.map +1 -0
- package/dist/tools/discovery/search.d.ts.map +1 -1
- package/dist/tools/discovery/search.js +23 -2
- package/dist/tools/discovery/search.js.map +1 -1
- package/dist/tools/discovery/types.d.ts +21 -0
- package/dist/tools/discovery/types.d.ts.map +1 -1
- package/dist/tools/discovery/validate.d.ts +63 -0
- package/dist/tools/discovery/validate.d.ts.map +1 -0
- package/dist/tools/discovery/validate.js +239 -0
- package/dist/tools/discovery/validate.js.map +1 -0
- package/dist/tools/generated/dependency-graph.json +1 -1
- package/package.json +1 -1
|
@@ -20,6 +20,19 @@ export interface ToolIndexEntry {
|
|
|
20
20
|
operation: string;
|
|
21
21
|
/** Brief summary for search matching */
|
|
22
22
|
summary: string;
|
|
23
|
+
/** Danger level (Phase A): low, medium, high */
|
|
24
|
+
dangerLevel: "low" | "medium" | "high";
|
|
25
|
+
/** Deprecation status (Phase A) */
|
|
26
|
+
isDeprecated: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Prerequisite hint for create operations (Phase B)
|
|
30
|
+
*/
|
|
31
|
+
export interface PrerequisiteHint {
|
|
32
|
+
/** Required resources before creating this resource */
|
|
33
|
+
resources: string[];
|
|
34
|
+
/** Human-readable hint about prerequisites */
|
|
35
|
+
hint: string;
|
|
23
36
|
}
|
|
24
37
|
/**
|
|
25
38
|
* Search result with relevance scoring
|
|
@@ -31,6 +44,8 @@ export interface SearchResult {
|
|
|
31
44
|
score: number;
|
|
32
45
|
/** Matched terms for highlighting */
|
|
33
46
|
matchedTerms: string[];
|
|
47
|
+
/** Prerequisite hints for create operations (Phase B) */
|
|
48
|
+
prerequisites?: PrerequisiteHint;
|
|
34
49
|
}
|
|
35
50
|
/**
|
|
36
51
|
* Search options for customizing tool discovery
|
|
@@ -44,6 +59,12 @@ export interface SearchOptions {
|
|
|
44
59
|
operations?: string[];
|
|
45
60
|
/** Minimum relevance score threshold (default: 0.1) */
|
|
46
61
|
minScore?: number;
|
|
62
|
+
/** Exclude high-danger operations from results (Phase A) */
|
|
63
|
+
excludeDangerous?: boolean;
|
|
64
|
+
/** Exclude deprecated operations from results (Phase A) */
|
|
65
|
+
excludeDeprecated?: boolean;
|
|
66
|
+
/** Include prerequisite hints for create operations (Phase B) */
|
|
67
|
+
includeDependencies?: boolean;
|
|
47
68
|
}
|
|
48
69
|
/**
|
|
49
70
|
* Tool index metadata for the entire index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/discovery/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/discovery/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,WAAW,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACvC,mCAAmC;IACnC,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,8BAA8B;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,yDAAyD;IACzD,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iEAAiE;IACjE,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,qBAAqB;IACrB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,uBAAuB;IACvB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameter Validation Module (Phase B)
|
|
3
|
+
*
|
|
4
|
+
* Provides pre-execution validation for F5XC API tool parameters.
|
|
5
|
+
* Validates path, query, and body parameters against tool schemas
|
|
6
|
+
* before making API calls.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Validation error detail
|
|
10
|
+
*/
|
|
11
|
+
export interface ValidationError {
|
|
12
|
+
/** Parameter path (e.g., "pathParams.namespace", "body.metadata.name") */
|
|
13
|
+
path: string;
|
|
14
|
+
/** Error message */
|
|
15
|
+
message: string;
|
|
16
|
+
/** Expected type or value */
|
|
17
|
+
expected?: string;
|
|
18
|
+
/** Actual value received */
|
|
19
|
+
actual?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Validation result
|
|
23
|
+
*/
|
|
24
|
+
export interface ValidationResult {
|
|
25
|
+
/** Whether validation passed */
|
|
26
|
+
valid: boolean;
|
|
27
|
+
/** List of validation errors */
|
|
28
|
+
errors: ValidationError[];
|
|
29
|
+
/** List of warnings (non-blocking issues) */
|
|
30
|
+
warnings: string[];
|
|
31
|
+
/** The validated tool (if found) */
|
|
32
|
+
tool?: {
|
|
33
|
+
name: string;
|
|
34
|
+
method: string;
|
|
35
|
+
path: string;
|
|
36
|
+
operation: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parameters to validate
|
|
41
|
+
*/
|
|
42
|
+
export interface ValidateParams {
|
|
43
|
+
/** Tool name to validate against */
|
|
44
|
+
toolName: string;
|
|
45
|
+
/** Path parameters */
|
|
46
|
+
pathParams?: Record<string, string>;
|
|
47
|
+
/** Query parameters */
|
|
48
|
+
queryParams?: Record<string, string>;
|
|
49
|
+
/** Request body */
|
|
50
|
+
body?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validate parameters for a tool before execution
|
|
54
|
+
*
|
|
55
|
+
* @param params - Parameters to validate
|
|
56
|
+
* @returns Validation result with errors and warnings
|
|
57
|
+
*/
|
|
58
|
+
export declare function validateToolParams(params: ValidateParams): ValidationResult;
|
|
59
|
+
/**
|
|
60
|
+
* Format validation result as user-friendly message
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatValidationResult(result: ValidationResult): string;
|
|
63
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/tools/discovery/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,gCAAgC;IAChC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,oCAAoC;IACpC,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,mBAAmB;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAwD3E;AAgLD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAiCvE"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameter Validation Module (Phase B)
|
|
3
|
+
*
|
|
4
|
+
* Provides pre-execution validation for F5XC API tool parameters.
|
|
5
|
+
* Validates path, query, and body parameters against tool schemas
|
|
6
|
+
* before making API calls.
|
|
7
|
+
*/
|
|
8
|
+
import { getToolByName } from "../registry.js";
|
|
9
|
+
/**
|
|
10
|
+
* Validate parameters for a tool before execution
|
|
11
|
+
*
|
|
12
|
+
* @param params - Parameters to validate
|
|
13
|
+
* @returns Validation result with errors and warnings
|
|
14
|
+
*/
|
|
15
|
+
export function validateToolParams(params) {
|
|
16
|
+
const { toolName, pathParams = {}, queryParams = {}, body } = params;
|
|
17
|
+
const errors = [];
|
|
18
|
+
const warnings = [];
|
|
19
|
+
// Get tool definition
|
|
20
|
+
const tool = getToolByName(toolName);
|
|
21
|
+
if (!tool) {
|
|
22
|
+
return {
|
|
23
|
+
valid: false,
|
|
24
|
+
errors: [
|
|
25
|
+
{
|
|
26
|
+
path: "toolName",
|
|
27
|
+
message: `Tool "${toolName}" not found`,
|
|
28
|
+
expected: "Valid tool name",
|
|
29
|
+
actual: toolName,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
warnings: [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
// Validate path parameters
|
|
36
|
+
validatePathParams(tool, pathParams, errors);
|
|
37
|
+
// Validate query parameters
|
|
38
|
+
validateQueryParams(tool, queryParams, errors, warnings);
|
|
39
|
+
// Validate request body
|
|
40
|
+
if (tool.requestBodySchema) {
|
|
41
|
+
validateBody(tool, body, errors, warnings);
|
|
42
|
+
}
|
|
43
|
+
else if (body && Object.keys(body).length > 0) {
|
|
44
|
+
warnings.push(`Tool ${toolName} does not accept a request body, but one was provided`);
|
|
45
|
+
}
|
|
46
|
+
// Check required fields from enriched metadata
|
|
47
|
+
if (tool.requiredFields && tool.requiredFields.length > 0) {
|
|
48
|
+
validateRequiredFields(tool.requiredFields, body, errors);
|
|
49
|
+
}
|
|
50
|
+
// Check oneOf constraints
|
|
51
|
+
if (tool.oneOfGroups && tool.oneOfGroups.length > 0) {
|
|
52
|
+
validateOneOfGroups(tool.oneOfGroups, body, warnings);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
valid: errors.length === 0,
|
|
56
|
+
errors,
|
|
57
|
+
warnings,
|
|
58
|
+
tool: {
|
|
59
|
+
name: tool.toolName,
|
|
60
|
+
method: tool.method,
|
|
61
|
+
path: tool.path,
|
|
62
|
+
operation: tool.operation,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate path parameters
|
|
68
|
+
*/
|
|
69
|
+
function validatePathParams(tool, pathParams, errors) {
|
|
70
|
+
// Check for missing required path parameters
|
|
71
|
+
for (const param of tool.pathParameters) {
|
|
72
|
+
if (param.required && !pathParams[param.name]) {
|
|
73
|
+
errors.push({
|
|
74
|
+
path: `pathParams.${param.name}`,
|
|
75
|
+
message: `Missing required path parameter: ${param.name}`,
|
|
76
|
+
expected: param.description || "string value",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Check for unknown path parameters
|
|
81
|
+
const knownParams = new Set(tool.pathParameters.map((p) => p.name));
|
|
82
|
+
for (const key of Object.keys(pathParams)) {
|
|
83
|
+
if (!knownParams.has(key)) {
|
|
84
|
+
errors.push({
|
|
85
|
+
path: `pathParams.${key}`,
|
|
86
|
+
message: `Unknown path parameter: ${key}`,
|
|
87
|
+
expected: `One of: ${[...knownParams].join(", ")}`,
|
|
88
|
+
actual: key,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validate query parameters
|
|
95
|
+
*/
|
|
96
|
+
function validateQueryParams(tool, queryParams, errors, warnings) {
|
|
97
|
+
// Check for missing required query parameters
|
|
98
|
+
for (const param of tool.queryParameters) {
|
|
99
|
+
if (param.required && !queryParams[param.name]) {
|
|
100
|
+
errors.push({
|
|
101
|
+
path: `queryParams.${param.name}`,
|
|
102
|
+
message: `Missing required query parameter: ${param.name}`,
|
|
103
|
+
expected: param.description || "string value",
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Check for unknown query parameters (warning only)
|
|
108
|
+
const knownParams = new Set(tool.queryParameters.map((p) => p.name));
|
|
109
|
+
for (const key of Object.keys(queryParams)) {
|
|
110
|
+
if (!knownParams.has(key)) {
|
|
111
|
+
warnings.push(`Unknown query parameter: ${key}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Validate request body
|
|
117
|
+
*/
|
|
118
|
+
function validateBody(tool, body, errors, warnings) {
|
|
119
|
+
// Check if body is required but missing
|
|
120
|
+
if (tool.method === "POST" || tool.method === "PUT") {
|
|
121
|
+
if (!body || Object.keys(body).length === 0) {
|
|
122
|
+
// For create/update, body is usually required
|
|
123
|
+
if (tool.operation === "create" || tool.operation === "update") {
|
|
124
|
+
errors.push({
|
|
125
|
+
path: "body",
|
|
126
|
+
message: "Request body is required for this operation",
|
|
127
|
+
expected: "Object with required fields",
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Basic structure validation for F5XC resources
|
|
133
|
+
if (body && tool.operation === "create") {
|
|
134
|
+
// Most F5XC resources require metadata.name and metadata.namespace
|
|
135
|
+
if (!body.metadata || typeof body.metadata !== "object") {
|
|
136
|
+
warnings.push("Body should include a 'metadata' object for F5XC resources");
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const metadata = body.metadata;
|
|
140
|
+
if (!metadata.name) {
|
|
141
|
+
warnings.push("metadata.name is typically required for F5XC resources");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Validate required fields from x-ves-required-fields
|
|
148
|
+
*/
|
|
149
|
+
function validateRequiredFields(requiredFields, body, errors) {
|
|
150
|
+
if (!body) {
|
|
151
|
+
for (const field of requiredFields) {
|
|
152
|
+
errors.push({
|
|
153
|
+
path: `body.${field}`,
|
|
154
|
+
message: `Missing required field: ${field}`,
|
|
155
|
+
expected: "Required by F5XC API",
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
for (const field of requiredFields) {
|
|
161
|
+
const value = getNestedValue(body, field);
|
|
162
|
+
if (value === undefined) {
|
|
163
|
+
errors.push({
|
|
164
|
+
path: `body.${field}`,
|
|
165
|
+
message: `Missing required field: ${field}`,
|
|
166
|
+
expected: "Required by F5XC API",
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Validate oneOf constraints (warning for multiple selections)
|
|
173
|
+
*/
|
|
174
|
+
function validateOneOfGroups(oneOfGroups, body, warnings) {
|
|
175
|
+
if (!body)
|
|
176
|
+
return;
|
|
177
|
+
for (const group of oneOfGroups) {
|
|
178
|
+
const selectedOptions = group.options.filter((option) => {
|
|
179
|
+
const value = getNestedValue(body, option);
|
|
180
|
+
return value !== undefined;
|
|
181
|
+
});
|
|
182
|
+
if (selectedOptions.length > 1) {
|
|
183
|
+
warnings.push(`Multiple mutually exclusive options selected for ${group.choiceField}: ${selectedOptions.join(", ")}. Choose only one.`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get nested value from object using dot notation
|
|
189
|
+
*/
|
|
190
|
+
function getNestedValue(obj, path) {
|
|
191
|
+
const parts = path.split(".");
|
|
192
|
+
let current = obj;
|
|
193
|
+
for (const part of parts) {
|
|
194
|
+
if (current === null || current === undefined) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
if (typeof current !== "object") {
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
current = current[part];
|
|
201
|
+
}
|
|
202
|
+
return current;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Format validation result as user-friendly message
|
|
206
|
+
*/
|
|
207
|
+
export function formatValidationResult(result) {
|
|
208
|
+
const lines = [];
|
|
209
|
+
if (result.valid) {
|
|
210
|
+
lines.push("✅ Validation passed");
|
|
211
|
+
if (result.tool) {
|
|
212
|
+
lines.push(` Tool: ${result.tool.name}`);
|
|
213
|
+
lines.push(` Operation: ${result.tool.method} ${result.tool.path}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
lines.push("❌ Validation failed");
|
|
218
|
+
lines.push("");
|
|
219
|
+
lines.push("Errors:");
|
|
220
|
+
for (const error of result.errors) {
|
|
221
|
+
lines.push(` • ${error.path}: ${error.message}`);
|
|
222
|
+
if (error.expected) {
|
|
223
|
+
lines.push(` Expected: ${error.expected}`);
|
|
224
|
+
}
|
|
225
|
+
if (error.actual) {
|
|
226
|
+
lines.push(` Actual: ${error.actual}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (result.warnings.length > 0) {
|
|
231
|
+
lines.push("");
|
|
232
|
+
lines.push("Warnings:");
|
|
233
|
+
for (const warning of result.warnings) {
|
|
234
|
+
lines.push(` ⚠️ ${warning}`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return lines.join("\n");
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/tools/discovery/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAmD/C;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACrE,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,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