@robinmordasiewicz/f5xc-api-mcp 1.0.82-2512312028
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/CHANGELOG.md +74 -0
- package/README.md +415 -0
- package/dist/auth/credential-manager.d.ts +151 -0
- package/dist/auth/credential-manager.d.ts.map +1 -0
- package/dist/auth/credential-manager.js +330 -0
- package/dist/auth/credential-manager.js.map +1 -0
- package/dist/auth/http-client.d.ts +81 -0
- package/dist/auth/http-client.d.ts.map +1 -0
- package/dist/auth/http-client.js +197 -0
- package/dist/auth/http-client.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +6 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/config/config-manager.d.ts +72 -0
- package/dist/config/config-manager.d.ts.map +1 -0
- package/dist/config/config-manager.js +247 -0
- package/dist/config/config-manager.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +74 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +75 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/types.d.ts +77 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +31 -0
- package/dist/config/types.js.map +1 -0
- package/dist/generator/dependency-extractor.d.ts +103 -0
- package/dist/generator/dependency-extractor.d.ts.map +1 -0
- package/dist/generator/dependency-extractor.js +473 -0
- package/dist/generator/dependency-extractor.js.map +1 -0
- package/dist/generator/dependency-graph.d.ts +67 -0
- package/dist/generator/dependency-graph.d.ts.map +1 -0
- package/dist/generator/dependency-graph.js +330 -0
- package/dist/generator/dependency-graph.js.map +1 -0
- package/dist/generator/dependency-types.d.ts +206 -0
- package/dist/generator/dependency-types.d.ts.map +1 -0
- package/dist/generator/dependency-types.js +37 -0
- package/dist/generator/dependency-types.js.map +1 -0
- package/dist/generator/index.d.ts +7 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +7 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/naming/acronyms.d.ts +81 -0
- package/dist/generator/naming/acronyms.d.ts.map +1 -0
- package/dist/generator/naming/acronyms.js +253 -0
- package/dist/generator/naming/acronyms.js.map +1 -0
- package/dist/generator/naming/index.d.ts +6 -0
- package/dist/generator/naming/index.d.ts.map +1 -0
- package/dist/generator/naming/index.js +6 -0
- package/dist/generator/naming/index.js.map +1 -0
- package/dist/generator/naming/volterra-mapping.d.ts +102 -0
- package/dist/generator/naming/volterra-mapping.d.ts.map +1 -0
- package/dist/generator/naming/volterra-mapping.js +259 -0
- package/dist/generator/naming/volterra-mapping.js.map +1 -0
- package/dist/generator/openapi-parser.d.ts +701 -0
- package/dist/generator/openapi-parser.d.ts.map +1 -0
- package/dist/generator/openapi-parser.js +704 -0
- package/dist/generator/openapi-parser.js.map +1 -0
- package/dist/generator/tool-generator.d.ts +118 -0
- package/dist/generator/tool-generator.d.ts.map +1 -0
- package/dist/generator/tool-generator.js +529 -0
- package/dist/generator/tool-generator.js.map +1 -0
- package/dist/generator/transformers/index.d.ts +7 -0
- package/dist/generator/transformers/index.d.ts.map +1 -0
- package/dist/generator/transformers/index.js +7 -0
- package/dist/generator/transformers/index.js.map +1 -0
- package/dist/generator/transformers/normalize-examples.d.ts +48 -0
- package/dist/generator/transformers/normalize-examples.d.ts.map +1 -0
- package/dist/generator/transformers/normalize-examples.js +66 -0
- package/dist/generator/transformers/normalize-examples.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +101 -0
- package/dist/index.js.map +1 -0
- 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 +8 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +7 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/workflows.d.ts +59 -0
- package/dist/prompts/workflows.d.ts.map +1 -0
- package/dist/prompts/workflows.js +441 -0
- package/dist/prompts/workflows.js.map +1 -0
- package/dist/resources/handlers.d.ts +70 -0
- package/dist/resources/handlers.d.ts.map +1 -0
- package/dist/resources/handlers.js +270 -0
- package/dist/resources/handlers.js.map +1 -0
- package/dist/resources/index.d.ts +8 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +6 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/templates.d.ts +86 -0
- package/dist/resources/templates.d.ts.map +1 -0
- package/dist/resources/templates.js +248 -0
- package/dist/resources/templates.js.map +1 -0
- package/dist/server.d.ts +78 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +721 -0
- package/dist/server.js.map +1 -0
- 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/consolidate.d.ts +97 -0
- package/dist/tools/discovery/consolidate.d.ts.map +1 -0
- package/dist/tools/discovery/consolidate.js +200 -0
- package/dist/tools/discovery/consolidate.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/dependencies.d.ts +113 -0
- package/dist/tools/discovery/dependencies.d.ts.map +1 -0
- package/dist/tools/discovery/dependencies.js +258 -0
- package/dist/tools/discovery/dependencies.js.map +1 -0
- package/dist/tools/discovery/describe.d.ts +133 -0
- package/dist/tools/discovery/describe.d.ts.map +1 -0
- package/dist/tools/discovery/describe.js +208 -0
- package/dist/tools/discovery/describe.js.map +1 -0
- package/dist/tools/discovery/execute.d.ts +96 -0
- package/dist/tools/discovery/execute.d.ts.map +1 -0
- package/dist/tools/discovery/execute.js +220 -0
- package/dist/tools/discovery/execute.js.map +1 -0
- package/dist/tools/discovery/index-loader.d.ts +28 -0
- package/dist/tools/discovery/index-loader.d.ts.map +1 -0
- package/dist/tools/discovery/index-loader.js +72 -0
- package/dist/tools/discovery/index-loader.js.map +1 -0
- package/dist/tools/discovery/index.d.ts +363 -0
- package/dist/tools/discovery/index.d.ts.map +1 -0
- package/dist/tools/discovery/index.js +361 -0
- package/dist/tools/discovery/index.js.map +1 -0
- 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 +41 -0
- package/dist/tools/discovery/search.d.ts.map +1 -0
- package/dist/tools/discovery/search.js +176 -0
- package/dist/tools/discovery/search.js.map +1 -0
- package/dist/tools/discovery/types.d.ts +91 -0
- package/dist/tools/discovery/types.d.ts.map +1 -0
- package/dist/tools/discovery/types.js +9 -0
- package/dist/tools/discovery/types.js.map +1 -0
- 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/admin_console_and_ui/index.d.ts +8 -0
- package/dist/tools/generated/admin_console_and_ui/index.d.ts.map +1 -0
- package/dist/tools/generated/admin_console_and_ui/index.js +265 -0
- package/dist/tools/generated/admin_console_and_ui/index.js.map +1 -0
- package/dist/tools/generated/api/index.d.ts +8 -0
- package/dist/tools/generated/api/index.d.ts.map +1 -0
- package/dist/tools/generated/api/index.js +7016 -0
- package/dist/tools/generated/api/index.js.map +1 -0
- package/dist/tools/generated/authentication/index.d.ts +8 -0
- package/dist/tools/generated/authentication/index.d.ts.map +1 -0
- package/dist/tools/generated/authentication/index.js +907 -0
- package/dist/tools/generated/authentication/index.js.map +1 -0
- package/dist/tools/generated/bigip/index.d.ts +8 -0
- package/dist/tools/generated/bigip/index.d.ts.map +1 -0
- package/dist/tools/generated/bigip/index.js +3152 -0
- package/dist/tools/generated/bigip/index.js.map +1 -0
- package/dist/tools/generated/billing_and_usage/index.d.ts +8 -0
- package/dist/tools/generated/billing_and_usage/index.d.ts.map +1 -0
- package/dist/tools/generated/billing_and_usage/index.js +2452 -0
- package/dist/tools/generated/billing_and_usage/index.js.map +1 -0
- package/dist/tools/generated/blindfold/index.d.ts +8 -0
- package/dist/tools/generated/blindfold/index.d.ts.map +1 -0
- package/dist/tools/generated/blindfold/index.js +3790 -0
- package/dist/tools/generated/blindfold/index.js.map +1 -0
- package/dist/tools/generated/bot_and_threat_defense/index.d.ts +8 -0
- package/dist/tools/generated/bot_and_threat_defense/index.d.ts.map +1 -0
- package/dist/tools/generated/bot_and_threat_defense/index.js +2746 -0
- package/dist/tools/generated/bot_and_threat_defense/index.js.map +1 -0
- package/dist/tools/generated/cdn/index.d.ts +8 -0
- package/dist/tools/generated/cdn/index.d.ts.map +1 -0
- package/dist/tools/generated/cdn/index.js +2686 -0
- package/dist/tools/generated/cdn/index.js.map +1 -0
- package/dist/tools/generated/ce_management/index.d.ts +8 -0
- package/dist/tools/generated/ce_management/index.d.ts.map +1 -0
- package/dist/tools/generated/ce_management/index.js +3812 -0
- package/dist/tools/generated/ce_management/index.js.map +1 -0
- package/dist/tools/generated/certificates/index.d.ts +8 -0
- package/dist/tools/generated/certificates/index.d.ts.map +1 -0
- package/dist/tools/generated/certificates/index.js +2547 -0
- package/dist/tools/generated/certificates/index.js.map +1 -0
- package/dist/tools/generated/cloud_infrastructure/index.d.ts +8 -0
- package/dist/tools/generated/cloud_infrastructure/index.d.ts.map +1 -0
- package/dist/tools/generated/cloud_infrastructure/index.js +3959 -0
- package/dist/tools/generated/cloud_infrastructure/index.js.map +1 -0
- package/dist/tools/generated/container_services/index.d.ts +8 -0
- package/dist/tools/generated/container_services/index.d.ts.map +1 -0
- package/dist/tools/generated/container_services/index.js +2018 -0
- package/dist/tools/generated/container_services/index.js.map +1 -0
- package/dist/tools/generated/data_and_privacy_security/index.d.ts +8 -0
- package/dist/tools/generated/data_and_privacy_security/index.d.ts.map +1 -0
- package/dist/tools/generated/data_and_privacy_security/index.js +1662 -0
- package/dist/tools/generated/data_and_privacy_security/index.js.map +1 -0
- package/dist/tools/generated/data_intelligence/index.d.ts +8 -0
- package/dist/tools/generated/data_intelligence/index.d.ts.map +1 -0
- package/dist/tools/generated/data_intelligence/index.js +1600 -0
- package/dist/tools/generated/data_intelligence/index.js.map +1 -0
- package/dist/tools/generated/ddos/index.d.ts +8 -0
- package/dist/tools/generated/ddos/index.d.ts.map +1 -0
- package/dist/tools/generated/ddos/index.js +8091 -0
- package/dist/tools/generated/ddos/index.js.map +1 -0
- package/dist/tools/generated/dependency-graph.json +26358 -0
- package/dist/tools/generated/dns/index.d.ts +8 -0
- package/dist/tools/generated/dns/index.d.ts.map +1 -0
- package/dist/tools/generated/dns/index.js +6096 -0
- package/dist/tools/generated/dns/index.js.map +1 -0
- package/dist/tools/generated/generative_ai/index.d.ts +8 -0
- package/dist/tools/generated/generative_ai/index.d.ts.map +1 -0
- package/dist/tools/generated/generative_ai/index.js +1019 -0
- package/dist/tools/generated/generative_ai/index.js.map +1 -0
- package/dist/tools/generated/managed_kubernetes/index.d.ts +8 -0
- package/dist/tools/generated/managed_kubernetes/index.d.ts.map +1 -0
- package/dist/tools/generated/managed_kubernetes/index.js +3368 -0
- package/dist/tools/generated/managed_kubernetes/index.js.map +1 -0
- package/dist/tools/generated/marketplace/index.d.ts +8 -0
- package/dist/tools/generated/marketplace/index.d.ts.map +1 -0
- package/dist/tools/generated/marketplace/index.js +4329 -0
- package/dist/tools/generated/marketplace/index.js.map +1 -0
- package/dist/tools/generated/network/index.d.ts +8 -0
- package/dist/tools/generated/network/index.d.ts.map +1 -0
- package/dist/tools/generated/network/index.js +12424 -0
- package/dist/tools/generated/network/index.js.map +1 -0
- package/dist/tools/generated/network_security/index.d.ts +8 -0
- package/dist/tools/generated/network_security/index.d.ts.map +1 -0
- package/dist/tools/generated/network_security/index.js +9637 -0
- package/dist/tools/generated/network_security/index.js.map +1 -0
- package/dist/tools/generated/nginx_one/index.d.ts +8 -0
- package/dist/tools/generated/nginx_one/index.d.ts.map +1 -0
- package/dist/tools/generated/nginx_one/index.js +1692 -0
- package/dist/tools/generated/nginx_one/index.js.map +1 -0
- package/dist/tools/generated/object_storage/index.d.ts +8 -0
- package/dist/tools/generated/object_storage/index.d.ts.map +1 -0
- package/dist/tools/generated/object_storage/index.js +996 -0
- package/dist/tools/generated/object_storage/index.js.map +1 -0
- package/dist/tools/generated/observability/index.d.ts +8 -0
- package/dist/tools/generated/observability/index.d.ts.map +1 -0
- package/dist/tools/generated/observability/index.js +5285 -0
- package/dist/tools/generated/observability/index.js.map +1 -0
- package/dist/tools/generated/rate_limiting/index.d.ts +8 -0
- package/dist/tools/generated/rate_limiting/index.d.ts.map +1 -0
- package/dist/tools/generated/rate_limiting/index.js +2108 -0
- package/dist/tools/generated/rate_limiting/index.js.map +1 -0
- package/dist/tools/generated/secops_and_incident_response/index.d.ts +8 -0
- package/dist/tools/generated/secops_and_incident_response/index.d.ts.map +1 -0
- package/dist/tools/generated/secops_and_incident_response/index.js +710 -0
- package/dist/tools/generated/secops_and_incident_response/index.js.map +1 -0
- package/dist/tools/generated/service_mesh/index.d.ts +8 -0
- package/dist/tools/generated/service_mesh/index.d.ts.map +1 -0
- package/dist/tools/generated/service_mesh/index.js +6062 -0
- package/dist/tools/generated/service_mesh/index.js.map +1 -0
- package/dist/tools/generated/shape/index.d.ts +8 -0
- package/dist/tools/generated/shape/index.d.ts.map +1 -0
- package/dist/tools/generated/shape/index.js +19381 -0
- package/dist/tools/generated/shape/index.js.map +1 -0
- package/dist/tools/generated/sites/index.d.ts +8 -0
- package/dist/tools/generated/sites/index.d.ts.map +1 -0
- package/dist/tools/generated/sites/index.js +13160 -0
- package/dist/tools/generated/sites/index.js.map +1 -0
- package/dist/tools/generated/statistics/index.d.ts +8 -0
- package/dist/tools/generated/statistics/index.d.ts.map +1 -0
- package/dist/tools/generated/statistics/index.js +8131 -0
- package/dist/tools/generated/statistics/index.js.map +1 -0
- package/dist/tools/generated/support/index.d.ts +8 -0
- package/dist/tools/generated/support/index.d.ts.map +1 -0
- package/dist/tools/generated/support/index.js +5608 -0
- package/dist/tools/generated/support/index.js.map +1 -0
- package/dist/tools/generated/telemetry_and_insights/index.d.ts +8 -0
- package/dist/tools/generated/telemetry_and_insights/index.d.ts.map +1 -0
- package/dist/tools/generated/telemetry_and_insights/index.js +2404 -0
- package/dist/tools/generated/telemetry_and_insights/index.js.map +1 -0
- package/dist/tools/generated/tenant_and_identity/index.d.ts +8 -0
- package/dist/tools/generated/tenant_and_identity/index.d.ts.map +1 -0
- package/dist/tools/generated/tenant_and_identity/index.js +18938 -0
- package/dist/tools/generated/tenant_and_identity/index.js.map +1 -0
- package/dist/tools/generated/threat_campaign/index.d.ts +8 -0
- package/dist/tools/generated/threat_campaign/index.d.ts.map +1 -0
- package/dist/tools/generated/threat_campaign/index.js +102 -0
- package/dist/tools/generated/threat_campaign/index.js.map +1 -0
- package/dist/tools/generated/users/index.d.ts +8 -0
- package/dist/tools/generated/users/index.d.ts.map +1 -0
- package/dist/tools/generated/users/index.js +1515 -0
- package/dist/tools/generated/users/index.js.map +1 -0
- package/dist/tools/generated/virtual/index.d.ts +8 -0
- package/dist/tools/generated/virtual/index.d.ts.map +1 -0
- package/dist/tools/generated/virtual/index.js +11263 -0
- package/dist/tools/generated/virtual/index.js.map +1 -0
- package/dist/tools/generated/vpm_and_node_management/index.d.ts +8 -0
- package/dist/tools/generated/vpm_and_node_management/index.d.ts.map +1 -0
- package/dist/tools/generated/vpm_and_node_management/index.js +88 -0
- package/dist/tools/generated/vpm_and_node_management/index.js.map +1 -0
- package/dist/tools/generated/waf/index.d.ts +8 -0
- package/dist/tools/generated/waf/index.d.ts.map +1 -0
- package/dist/tools/generated/waf/index.js +4586 -0
- package/dist/tools/generated/waf/index.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +27 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +115 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/utils/error-handling.d.ts +109 -0
- package/dist/utils/error-handling.d.ts.map +1 -0
- package/dist/utils/error-handling.js +239 -0
- package/dist/utils/error-handling.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logging.d.ts +75 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +131 -0
- package/dist/utils/logging.js.map +1 -0
- package/manifest.json +143 -0
- package/package.json +110 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Description Loader
|
|
3
|
+
*
|
|
4
|
+
* Loads full tool schemas on-demand for specific tools.
|
|
5
|
+
* This implements lazy loading to avoid upfront token consumption.
|
|
6
|
+
*/
|
|
7
|
+
import type { ParsedOperation } from "../../generator/openapi-parser.js";
|
|
8
|
+
/**
|
|
9
|
+
* Simplified tool description for MCP response
|
|
10
|
+
* Contains the essential information needed to execute a tool
|
|
11
|
+
*/
|
|
12
|
+
export interface ToolDescription {
|
|
13
|
+
/** Tool name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Human-readable summary */
|
|
16
|
+
summary: string;
|
|
17
|
+
/** Detailed description */
|
|
18
|
+
description: string;
|
|
19
|
+
/** HTTP method */
|
|
20
|
+
method: string;
|
|
21
|
+
/** API path template */
|
|
22
|
+
path: string;
|
|
23
|
+
/** Domain category */
|
|
24
|
+
domain: string;
|
|
25
|
+
/** Resource type */
|
|
26
|
+
resource: string;
|
|
27
|
+
/** Operation type */
|
|
28
|
+
operation: string;
|
|
29
|
+
/** Required parameters (path + query + body) */
|
|
30
|
+
requiredParams: string[];
|
|
31
|
+
/** Path parameters with descriptions */
|
|
32
|
+
pathParameters: ParameterDescription[];
|
|
33
|
+
/** Query parameters with descriptions */
|
|
34
|
+
queryParameters: ParameterDescription[];
|
|
35
|
+
/** Whether request body is required */
|
|
36
|
+
hasRequestBody: boolean;
|
|
37
|
+
/** Request body schema reference (if any) */
|
|
38
|
+
requestBodyRef: string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Simplified parameter description
|
|
42
|
+
*/
|
|
43
|
+
export interface ParameterDescription {
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
required: boolean;
|
|
47
|
+
type: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get full tool description by name
|
|
51
|
+
*
|
|
52
|
+
* @param toolName - The exact tool name
|
|
53
|
+
* @returns Full tool description or null if not found
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const desc = describeTool("f5xc-api-waap-http-loadbalancer-create");
|
|
58
|
+
* if (desc) {
|
|
59
|
+
* console.log(desc.requiredParams);
|
|
60
|
+
* console.log(desc.pathParameters);
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function describeTool(toolName: string): ToolDescription | null;
|
|
65
|
+
/**
|
|
66
|
+
* Get the full ParsedOperation for a tool (includes raw schemas)
|
|
67
|
+
*
|
|
68
|
+
* Use this when you need the complete tool definition including
|
|
69
|
+
* full request/response schemas. More expensive than describeTool.
|
|
70
|
+
*
|
|
71
|
+
* @param toolName - The exact tool name
|
|
72
|
+
* @returns Full ParsedOperation or null if not found
|
|
73
|
+
*/
|
|
74
|
+
export declare function getFullToolSchema(toolName: string): ParsedOperation | null;
|
|
75
|
+
/**
|
|
76
|
+
* Get multiple tool descriptions at once
|
|
77
|
+
*
|
|
78
|
+
* @param toolNames - Array of tool names
|
|
79
|
+
* @returns Map of tool name to description (excludes not found tools)
|
|
80
|
+
*/
|
|
81
|
+
export declare function describeTools(toolNames: string[]): Map<string, ToolDescription>;
|
|
82
|
+
/**
|
|
83
|
+
* Get tool description with validation
|
|
84
|
+
*
|
|
85
|
+
* @param toolName - The tool name to describe
|
|
86
|
+
* @returns Object with success status and either description or error
|
|
87
|
+
*/
|
|
88
|
+
export declare function describeToolSafe(toolName: string): {
|
|
89
|
+
success: boolean;
|
|
90
|
+
description?: ToolDescription;
|
|
91
|
+
error?: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Compact tool description for minimal token usage
|
|
95
|
+
* Omits optional fields and uses abbreviated format
|
|
96
|
+
*/
|
|
97
|
+
export interface CompactToolDescription {
|
|
98
|
+
n: string;
|
|
99
|
+
m: string;
|
|
100
|
+
p: string;
|
|
101
|
+
d: string;
|
|
102
|
+
r: string;
|
|
103
|
+
o: string;
|
|
104
|
+
s: string;
|
|
105
|
+
rp: string[];
|
|
106
|
+
pp: Array<{
|
|
107
|
+
n: string;
|
|
108
|
+
r: boolean;
|
|
109
|
+
}>;
|
|
110
|
+
qp: Array<{
|
|
111
|
+
n: string;
|
|
112
|
+
r: boolean;
|
|
113
|
+
}>;
|
|
114
|
+
rb: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get ultra-compact tool description for maximum token efficiency
|
|
118
|
+
* Reduces description size by ~60% compared to full description
|
|
119
|
+
*
|
|
120
|
+
* @param toolName - The exact tool name
|
|
121
|
+
* @returns Compact description or null if not found
|
|
122
|
+
*/
|
|
123
|
+
export declare function describeToolCompact(toolName: string): CompactToolDescription | null;
|
|
124
|
+
/**
|
|
125
|
+
* Calculate token savings from schema optimization
|
|
126
|
+
* Uses dynamically selected tools from the registry - no hardcoded tool names
|
|
127
|
+
*/
|
|
128
|
+
export declare function getOptimizationStats(): {
|
|
129
|
+
avgOriginalParamDescLen: number;
|
|
130
|
+
avgOptimizedParamDescLen: number;
|
|
131
|
+
estimatedSavingsPercent: string;
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../src/tools/discovery/describe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAIzE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,wCAAwC;IACxC,cAAc,EAAE,oBAAoB,EAAE,CAAC;IACvC,yCAAyC;IACzC,eAAe,EAAE,oBAAoB,EAAE,CAAC;IACxC,uCAAuC;IACvC,cAAc,EAAE,OAAO,CAAC;IACxB,6CAA6C;IAC7C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAoDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CA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|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Description Loader
|
|
3
|
+
*
|
|
4
|
+
* Loads full tool schemas on-demand for specific tools.
|
|
5
|
+
* This implements lazy loading to avoid upfront token consumption.
|
|
6
|
+
*/
|
|
7
|
+
import { getToolByName } from "../registry.js";
|
|
8
|
+
import { toolExists, getToolEntry, getToolIndex } from "./index-loader.js";
|
|
9
|
+
/**
|
|
10
|
+
* Common parameter descriptions (shared to save tokens)
|
|
11
|
+
* These replace verbose OpenAPI descriptions with concise versions
|
|
12
|
+
*/
|
|
13
|
+
const COMMON_PARAM_DESCRIPTIONS = {
|
|
14
|
+
namespace: "Target namespace (e.g., 'default')",
|
|
15
|
+
"metadata.namespace": "Target namespace for the resource",
|
|
16
|
+
name: "Resource name",
|
|
17
|
+
"metadata.name": "Resource name identifier",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Optimize parameter description by using shared descriptions for common params
|
|
21
|
+
* and truncating verbose descriptions
|
|
22
|
+
*/
|
|
23
|
+
function optimizeDescription(name, description) {
|
|
24
|
+
// Use shared description if available
|
|
25
|
+
if (COMMON_PARAM_DESCRIPTIONS[name]) {
|
|
26
|
+
return COMMON_PARAM_DESCRIPTIONS[name];
|
|
27
|
+
}
|
|
28
|
+
// Truncate verbose descriptions (keep first sentence or 100 chars)
|
|
29
|
+
if (description.length > 100) {
|
|
30
|
+
const firstSentence = description.split(/[.\n]/)[0];
|
|
31
|
+
if (firstSentence && firstSentence.length <= 100) {
|
|
32
|
+
return firstSentence;
|
|
33
|
+
}
|
|
34
|
+
return description.slice(0, 97) + "...";
|
|
35
|
+
}
|
|
36
|
+
return description;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extract parameter description from OpenAPI parameter
|
|
40
|
+
*/
|
|
41
|
+
function extractParameterDescription(param) {
|
|
42
|
+
return {
|
|
43
|
+
name: param.name,
|
|
44
|
+
description: optimizeDescription(param.name, param.description ?? ""),
|
|
45
|
+
required: param.required ?? false,
|
|
46
|
+
type: param.schema?.type ?? "string",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get full tool description by name
|
|
51
|
+
*
|
|
52
|
+
* @param toolName - The exact tool name
|
|
53
|
+
* @returns Full tool description or null if not found
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const desc = describeTool("f5xc-api-waap-http-loadbalancer-create");
|
|
58
|
+
* if (desc) {
|
|
59
|
+
* console.log(desc.requiredParams);
|
|
60
|
+
* console.log(desc.pathParameters);
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export function describeTool(toolName) {
|
|
65
|
+
const tool = getToolByName(toolName);
|
|
66
|
+
if (!tool) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
// Extract request body schema reference
|
|
70
|
+
let requestBodyRef = null;
|
|
71
|
+
if (tool.requestBodySchema) {
|
|
72
|
+
const ref = tool.requestBodySchema.$ref;
|
|
73
|
+
if (typeof ref === "string") {
|
|
74
|
+
// Extract just the schema name from the reference
|
|
75
|
+
requestBodyRef = ref.replace("#/components/schemas/", "");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
name: tool.toolName,
|
|
80
|
+
summary: tool.summary,
|
|
81
|
+
description: tool.description,
|
|
82
|
+
method: tool.method,
|
|
83
|
+
path: tool.path,
|
|
84
|
+
domain: tool.domain,
|
|
85
|
+
resource: tool.resource,
|
|
86
|
+
operation: tool.operation,
|
|
87
|
+
requiredParams: tool.requiredParams,
|
|
88
|
+
pathParameters: tool.pathParameters.map(extractParameterDescription),
|
|
89
|
+
queryParameters: tool.queryParameters.map(extractParameterDescription),
|
|
90
|
+
hasRequestBody: tool.requestBodySchema !== null,
|
|
91
|
+
requestBodyRef,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get the full ParsedOperation for a tool (includes raw schemas)
|
|
96
|
+
*
|
|
97
|
+
* Use this when you need the complete tool definition including
|
|
98
|
+
* full request/response schemas. More expensive than describeTool.
|
|
99
|
+
*
|
|
100
|
+
* @param toolName - The exact tool name
|
|
101
|
+
* @returns Full ParsedOperation or null if not found
|
|
102
|
+
*/
|
|
103
|
+
export function getFullToolSchema(toolName) {
|
|
104
|
+
return getToolByName(toolName) ?? null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get multiple tool descriptions at once
|
|
108
|
+
*
|
|
109
|
+
* @param toolNames - Array of tool names
|
|
110
|
+
* @returns Map of tool name to description (excludes not found tools)
|
|
111
|
+
*/
|
|
112
|
+
export function describeTools(toolNames) {
|
|
113
|
+
const results = new Map();
|
|
114
|
+
for (const name of toolNames) {
|
|
115
|
+
const desc = describeTool(name);
|
|
116
|
+
if (desc) {
|
|
117
|
+
results.set(name, desc);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return results;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get tool description with validation
|
|
124
|
+
*
|
|
125
|
+
* @param toolName - The tool name to describe
|
|
126
|
+
* @returns Object with success status and either description or error
|
|
127
|
+
*/
|
|
128
|
+
export function describeToolSafe(toolName) {
|
|
129
|
+
if (!toolExists(toolName)) {
|
|
130
|
+
// Try to find similar tools
|
|
131
|
+
const entry = getToolEntry(toolName);
|
|
132
|
+
if (!entry) {
|
|
133
|
+
return {
|
|
134
|
+
success: false,
|
|
135
|
+
error: `Tool "${toolName}" not found. Use search_tools to find available tools.`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const description = describeTool(toolName);
|
|
140
|
+
if (!description) {
|
|
141
|
+
return {
|
|
142
|
+
success: false,
|
|
143
|
+
error: `Failed to load description for tool "${toolName}".`,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return { success: true, description };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get ultra-compact tool description for maximum token efficiency
|
|
150
|
+
* Reduces description size by ~60% compared to full description
|
|
151
|
+
*
|
|
152
|
+
* @param toolName - The exact tool name
|
|
153
|
+
* @returns Compact description or null if not found
|
|
154
|
+
*/
|
|
155
|
+
export function describeToolCompact(toolName) {
|
|
156
|
+
const tool = getToolByName(toolName);
|
|
157
|
+
if (!tool) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
n: tool.toolName,
|
|
162
|
+
m: tool.method,
|
|
163
|
+
p: tool.path,
|
|
164
|
+
d: tool.domain,
|
|
165
|
+
r: tool.resource,
|
|
166
|
+
o: tool.operation,
|
|
167
|
+
s: tool.summary,
|
|
168
|
+
rp: tool.requiredParams,
|
|
169
|
+
pp: tool.pathParameters.map((p) => ({ n: p.name, r: p.required ?? true })),
|
|
170
|
+
qp: tool.queryParameters.map((p) => ({ n: p.name, r: p.required ?? false })),
|
|
171
|
+
rb: tool.requestBodySchema !== null,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Calculate token savings from schema optimization
|
|
176
|
+
* Uses dynamically selected tools from the registry - no hardcoded tool names
|
|
177
|
+
*/
|
|
178
|
+
export function getOptimizationStats() {
|
|
179
|
+
// Dynamically get sample tools with path parameters from the registry
|
|
180
|
+
const allTools = getToolIndex().tools;
|
|
181
|
+
// Find tools that likely have path parameters (create and list operations)
|
|
182
|
+
const sampleTools = allTools
|
|
183
|
+
.filter((t) => t.operation === "create" || t.operation === "list")
|
|
184
|
+
.slice(0, 5)
|
|
185
|
+
.map((t) => t.name);
|
|
186
|
+
let originalTotal = 0;
|
|
187
|
+
let optimizedTotal = 0;
|
|
188
|
+
let count = 0;
|
|
189
|
+
for (const name of sampleTools) {
|
|
190
|
+
const tool = getToolByName(name);
|
|
191
|
+
if (tool && tool.pathParameters.length > 0) {
|
|
192
|
+
for (const param of tool.pathParameters) {
|
|
193
|
+
originalTotal += (param.description ?? "").length;
|
|
194
|
+
optimizedTotal += optimizeDescription(param.name, param.description ?? "").length;
|
|
195
|
+
count++;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const avgOriginal = count > 0 ? Math.round(originalTotal / count) : 0;
|
|
200
|
+
const avgOptimized = count > 0 ? Math.round(optimizedTotal / count) : 0;
|
|
201
|
+
const savings = avgOriginal > 0 ? ((avgOriginal - avgOptimized) / avgOriginal) * 100 : 0;
|
|
202
|
+
return {
|
|
203
|
+
avgOriginalParamDescLen: avgOriginal,
|
|
204
|
+
avgOptimizedParamDescLen: avgOptimized,
|
|
205
|
+
estimatedSavingsPercent: `${savings.toFixed(1)}%`,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=describe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../src/tools/discovery/describe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA6C3E;;;GAGG;AACH,MAAM,yBAAyB,GAA2B;IACxD,SAAS,EAAE,oCAAoC;IAC/C,oBAAoB,EAAE,mCAAmC;IACzD,IAAI,EAAE,eAAe;IACrB,eAAe,EAAE,0BAA0B;CAC5C,CAAC;AAEF;;;GAGG;AACH,SAAS,mBAAmB,CAAC,IAAY,EAAE,WAAmB;IAC5D,sCAAsC;IACtC,IAAI,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,mEAAmE;IACnE,IAAI,WAAW,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QAC7B,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,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MAAM,OAAO,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,YAAY,CAAC,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzF,OAAO;QACL,uBAAuB,EAAE,WAAW;QACpC,wBAAwB,EAAE,YAAY;QACtC,uBAAuB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Execution Dispatcher
|
|
3
|
+
*
|
|
4
|
+
* Routes tool execution requests to the appropriate handler.
|
|
5
|
+
* This provides a unified interface for executing any discovered tool.
|
|
6
|
+
*/
|
|
7
|
+
import { CredentialManager } from "../../auth/credential-manager.js";
|
|
8
|
+
/**
|
|
9
|
+
* Tool execution parameters
|
|
10
|
+
*/
|
|
11
|
+
export interface ExecuteToolParams {
|
|
12
|
+
/** The tool name to execute */
|
|
13
|
+
toolName: string;
|
|
14
|
+
/** Path parameters (e.g., { namespace: "default", name: "example-lb" }) */
|
|
15
|
+
pathParams?: Record<string, string>;
|
|
16
|
+
/** Query parameters */
|
|
17
|
+
queryParams?: Record<string, string | string[]>;
|
|
18
|
+
/** Request body (for POST/PUT/PATCH) */
|
|
19
|
+
body?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Tool execution result
|
|
23
|
+
*/
|
|
24
|
+
export interface ExecuteToolResult {
|
|
25
|
+
/** Whether execution was successful */
|
|
26
|
+
success: boolean;
|
|
27
|
+
/** Response data (if successful) */
|
|
28
|
+
data?: unknown;
|
|
29
|
+
/** Error message (if failed) */
|
|
30
|
+
error?: string;
|
|
31
|
+
/** HTTP status code (if API call was made) */
|
|
32
|
+
statusCode?: number;
|
|
33
|
+
/** Tool metadata */
|
|
34
|
+
toolInfo: {
|
|
35
|
+
name: string;
|
|
36
|
+
method: string;
|
|
37
|
+
path: string;
|
|
38
|
+
operation: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Documentation-mode response when not authenticated
|
|
43
|
+
*/
|
|
44
|
+
export interface DocumentationResponse {
|
|
45
|
+
/** The tool that was requested */
|
|
46
|
+
tool: {
|
|
47
|
+
name: string;
|
|
48
|
+
summary: string;
|
|
49
|
+
method: string;
|
|
50
|
+
path: string;
|
|
51
|
+
domain: string;
|
|
52
|
+
resource: string;
|
|
53
|
+
operation: string;
|
|
54
|
+
};
|
|
55
|
+
/** Terraform resource example (if applicable) */
|
|
56
|
+
terraformExample?: string;
|
|
57
|
+
/** curl command example */
|
|
58
|
+
curlExample: string;
|
|
59
|
+
/** Message about authentication */
|
|
60
|
+
authMessage: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Execute a tool by name with the given parameters
|
|
64
|
+
*
|
|
65
|
+
* In authenticated mode: Makes the actual API call
|
|
66
|
+
* In documentation mode: Returns API examples and documentation
|
|
67
|
+
*
|
|
68
|
+
* @param params - Execution parameters
|
|
69
|
+
* @param credentialManager - Optional credential manager for auth
|
|
70
|
+
* @returns Execution result or documentation
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* // Execute in authenticated mode
|
|
75
|
+
* const result = await executeTool({
|
|
76
|
+
* toolName: "f5xc-api-waap-http-loadbalancer-list",
|
|
77
|
+
* pathParams: { namespace: "default" }
|
|
78
|
+
* }, credentialManager);
|
|
79
|
+
*
|
|
80
|
+
* // Execute in documentation mode (no credentials)
|
|
81
|
+
* const docs = await executeTool({
|
|
82
|
+
* toolName: "f5xc-api-waap-http-loadbalancer-create",
|
|
83
|
+
* pathParams: { "metadata.namespace": "default" },
|
|
84
|
+
* body: { metadata: { name: "example-lb" }, spec: { ... } }
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function executeTool(params: ExecuteToolParams, credentialManager?: CredentialManager): Promise<ExecuteToolResult | DocumentationResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* Validate execution parameters before running
|
|
91
|
+
*/
|
|
92
|
+
export declare function validateExecuteParams(toolName: string, params: ExecuteToolParams): {
|
|
93
|
+
valid: boolean;
|
|
94
|
+
errors: string[];
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/tools/discovery/execute.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,iBAAiB,EAAY,MAAM,kCAAkC,CAAC;AAI/E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAChD,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,QAAQ,EAAE;QACR,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,qBAAqB;IACpC,kCAAkC;IAClC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;CACrB;AAwFD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,iBAAiB,EACzB,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,OAAO,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,CAiGpD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,iBAAiB,GACxB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CA4BtC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Execution Dispatcher
|
|
3
|
+
*
|
|
4
|
+
* Routes tool execution requests to the appropriate handler.
|
|
5
|
+
* This provides a unified interface for executing any discovered tool.
|
|
6
|
+
*/
|
|
7
|
+
import { getToolByName } from "../registry.js";
|
|
8
|
+
import { toolExists } from "./index-loader.js";
|
|
9
|
+
import { CredentialManager, AuthMode } from "../../auth/credential-manager.js";
|
|
10
|
+
import { createHttpClient } from "../../auth/http-client.js";
|
|
11
|
+
import { logger } from "../../utils/logging.js";
|
|
12
|
+
/**
|
|
13
|
+
* Build path with parameters substituted
|
|
14
|
+
*/
|
|
15
|
+
function buildPath(pathTemplate, pathParams) {
|
|
16
|
+
let path = pathTemplate;
|
|
17
|
+
for (const [key, value] of Object.entries(pathParams)) {
|
|
18
|
+
// Handle both {param} and {metadata.param} style placeholders
|
|
19
|
+
path = path.replace(`{${key}}`, encodeURIComponent(value));
|
|
20
|
+
}
|
|
21
|
+
// Check for any remaining unsubstituted parameters
|
|
22
|
+
const remaining = path.match(/\{[^}]+\}/g);
|
|
23
|
+
if (remaining) {
|
|
24
|
+
throw new Error(`Missing path parameters: ${remaining.join(", ")}`);
|
|
25
|
+
}
|
|
26
|
+
return path;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build query string from parameters
|
|
30
|
+
*/
|
|
31
|
+
function buildQueryString(queryParams) {
|
|
32
|
+
const parts = [];
|
|
33
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
for (const v of value) {
|
|
36
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return parts.length > 0 ? `?${parts.join("&")}` : "";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Generate curl command example
|
|
47
|
+
*/
|
|
48
|
+
function generateCurlCommand(tool, params, apiUrl) {
|
|
49
|
+
const path = buildPath(tool.path, params.pathParams ?? {});
|
|
50
|
+
const queryString = buildQueryString(params.queryParams ?? {});
|
|
51
|
+
const fullUrl = `${apiUrl}${path}${queryString}`;
|
|
52
|
+
let cmd = `curl -X ${tool.method} "${fullUrl}"`;
|
|
53
|
+
cmd += ' \\\n -H "Authorization: APIToken $F5XC_API_TOKEN"';
|
|
54
|
+
cmd += ' \\\n -H "Content-Type: application/json"';
|
|
55
|
+
if (params.body && ["POST", "PUT", "PATCH"].includes(tool.method)) {
|
|
56
|
+
cmd += ` \\\n -d '${JSON.stringify(params.body, null, 2)}'`;
|
|
57
|
+
}
|
|
58
|
+
return cmd;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Generate documentation response for unauthenticated mode
|
|
62
|
+
*/
|
|
63
|
+
function generateDocumentationResponse(tool, params) {
|
|
64
|
+
const apiUrl = "https://{tenant}.console.ves.volterra.io/api";
|
|
65
|
+
return {
|
|
66
|
+
tool: {
|
|
67
|
+
name: tool.toolName,
|
|
68
|
+
summary: tool.summary,
|
|
69
|
+
method: tool.method,
|
|
70
|
+
path: tool.path,
|
|
71
|
+
domain: tool.domain,
|
|
72
|
+
resource: tool.resource,
|
|
73
|
+
operation: tool.operation,
|
|
74
|
+
},
|
|
75
|
+
curlExample: generateCurlCommand(tool, params, apiUrl),
|
|
76
|
+
authMessage: "API execution disabled. Set F5XC_API_URL and F5XC_API_TOKEN to enable execution.",
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Execute a tool by name with the given parameters
|
|
81
|
+
*
|
|
82
|
+
* In authenticated mode: Makes the actual API call
|
|
83
|
+
* In documentation mode: Returns API examples and documentation
|
|
84
|
+
*
|
|
85
|
+
* @param params - Execution parameters
|
|
86
|
+
* @param credentialManager - Optional credential manager for auth
|
|
87
|
+
* @returns Execution result or documentation
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Execute in authenticated mode
|
|
92
|
+
* const result = await executeTool({
|
|
93
|
+
* toolName: "f5xc-api-waap-http-loadbalancer-list",
|
|
94
|
+
* pathParams: { namespace: "default" }
|
|
95
|
+
* }, credentialManager);
|
|
96
|
+
*
|
|
97
|
+
* // Execute in documentation mode (no credentials)
|
|
98
|
+
* const docs = await executeTool({
|
|
99
|
+
* toolName: "f5xc-api-waap-http-loadbalancer-create",
|
|
100
|
+
* pathParams: { "metadata.namespace": "default" },
|
|
101
|
+
* body: { metadata: { name: "example-lb" }, spec: { ... } }
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export async function executeTool(params, credentialManager) {
|
|
106
|
+
const { toolName, pathParams = {}, queryParams = {}, body } = params;
|
|
107
|
+
// Validate tool exists
|
|
108
|
+
if (!toolExists(toolName)) {
|
|
109
|
+
return {
|
|
110
|
+
success: false,
|
|
111
|
+
error: `Tool "${toolName}" not found. Use search_tools to find available tools.`,
|
|
112
|
+
toolInfo: {
|
|
113
|
+
name: toolName,
|
|
114
|
+
method: "UNKNOWN",
|
|
115
|
+
path: "UNKNOWN",
|
|
116
|
+
operation: "UNKNOWN",
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// Get full tool definition
|
|
121
|
+
const tool = getToolByName(toolName);
|
|
122
|
+
if (!tool) {
|
|
123
|
+
return {
|
|
124
|
+
success: false,
|
|
125
|
+
error: `Failed to load tool "${toolName}".`,
|
|
126
|
+
toolInfo: {
|
|
127
|
+
name: toolName,
|
|
128
|
+
method: "UNKNOWN",
|
|
129
|
+
path: "UNKNOWN",
|
|
130
|
+
operation: "UNKNOWN",
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
const toolInfo = {
|
|
135
|
+
name: tool.toolName,
|
|
136
|
+
method: tool.method,
|
|
137
|
+
path: tool.path,
|
|
138
|
+
operation: tool.operation,
|
|
139
|
+
};
|
|
140
|
+
// Check authentication
|
|
141
|
+
const creds = credentialManager ?? new CredentialManager();
|
|
142
|
+
const authMode = creds.getAuthMode();
|
|
143
|
+
if (authMode === AuthMode.NONE) {
|
|
144
|
+
// Return documentation response
|
|
145
|
+
return generateDocumentationResponse(tool, params);
|
|
146
|
+
}
|
|
147
|
+
// Authenticated mode - execute API call
|
|
148
|
+
try {
|
|
149
|
+
const httpClient = createHttpClient(creds);
|
|
150
|
+
const path = buildPath(tool.path, pathParams);
|
|
151
|
+
const queryString = buildQueryString(queryParams);
|
|
152
|
+
const fullPath = `${path}${queryString}`;
|
|
153
|
+
logger.debug(`Executing tool: ${toolName}`, { method: tool.method, path: fullPath });
|
|
154
|
+
let response;
|
|
155
|
+
switch (tool.method.toUpperCase()) {
|
|
156
|
+
case "GET":
|
|
157
|
+
response = await httpClient.get(fullPath);
|
|
158
|
+
break;
|
|
159
|
+
case "POST":
|
|
160
|
+
response = await httpClient.post(fullPath, body);
|
|
161
|
+
break;
|
|
162
|
+
case "PUT":
|
|
163
|
+
response = await httpClient.put(fullPath, body);
|
|
164
|
+
break;
|
|
165
|
+
case "DELETE":
|
|
166
|
+
response = await httpClient.delete(fullPath);
|
|
167
|
+
break;
|
|
168
|
+
default:
|
|
169
|
+
return {
|
|
170
|
+
success: false,
|
|
171
|
+
error: `Unsupported HTTP method: ${tool.method}`,
|
|
172
|
+
toolInfo,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
success: true,
|
|
177
|
+
data: response.data,
|
|
178
|
+
statusCode: response.status,
|
|
179
|
+
toolInfo,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
logger.error(`Tool execution failed: ${toolName}`, {
|
|
184
|
+
error: error instanceof Error ? error.message : String(error),
|
|
185
|
+
});
|
|
186
|
+
return {
|
|
187
|
+
success: false,
|
|
188
|
+
error: error instanceof Error ? error.message : "Unknown error occurred",
|
|
189
|
+
toolInfo,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Validate execution parameters before running
|
|
195
|
+
*/
|
|
196
|
+
export function validateExecuteParams(toolName, params) {
|
|
197
|
+
const errors = [];
|
|
198
|
+
// Check tool exists
|
|
199
|
+
const tool = getToolByName(toolName);
|
|
200
|
+
if (!tool) {
|
|
201
|
+
return { valid: false, errors: [`Tool "${toolName}" not found`] };
|
|
202
|
+
}
|
|
203
|
+
// Check required path parameters
|
|
204
|
+
for (const param of tool.pathParameters) {
|
|
205
|
+
if (param.required) {
|
|
206
|
+
const value = params.pathParams?.[param.name] ?? params.pathParams?.[param.name.replace("metadata.", "")];
|
|
207
|
+
if (!value) {
|
|
208
|
+
errors.push(`Missing required path parameter: ${param.name}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Check if body is required
|
|
213
|
+
if (tool.requestBodySchema && !params.body) {
|
|
214
|
+
if (["POST", "PUT", "PATCH"].includes(tool.method)) {
|
|
215
|
+
errors.push("Request body is required for this operation");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return { valid: errors.length === 0, errors };
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=execute.js.map
|