@robinmordasiewicz/f5xc-api-mcp 3.0.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.
Files changed (212) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +234 -0
  3. package/dist/auth/credential-manager.d.ts +116 -0
  4. package/dist/auth/credential-manager.d.ts.map +1 -0
  5. package/dist/auth/credential-manager.js +208 -0
  6. package/dist/auth/credential-manager.js.map +1 -0
  7. package/dist/auth/http-client.d.ts +81 -0
  8. package/dist/auth/http-client.d.ts.map +1 -0
  9. package/dist/auth/http-client.js +197 -0
  10. package/dist/auth/http-client.js.map +1 -0
  11. package/dist/auth/index.d.ts +8 -0
  12. package/dist/auth/index.d.ts.map +1 -0
  13. package/dist/auth/index.js +6 -0
  14. package/dist/auth/index.js.map +1 -0
  15. package/dist/generator/index.d.ts +7 -0
  16. package/dist/generator/index.d.ts.map +1 -0
  17. package/dist/generator/index.js +7 -0
  18. package/dist/generator/index.js.map +1 -0
  19. package/dist/generator/naming/acronyms.d.ts +81 -0
  20. package/dist/generator/naming/acronyms.d.ts.map +1 -0
  21. package/dist/generator/naming/acronyms.js +253 -0
  22. package/dist/generator/naming/acronyms.js.map +1 -0
  23. package/dist/generator/naming/index.d.ts +6 -0
  24. package/dist/generator/naming/index.d.ts.map +1 -0
  25. package/dist/generator/naming/index.js +6 -0
  26. package/dist/generator/naming/index.js.map +1 -0
  27. package/dist/generator/naming/volterra-mapping.d.ts +102 -0
  28. package/dist/generator/naming/volterra-mapping.d.ts.map +1 -0
  29. package/dist/generator/naming/volterra-mapping.js +259 -0
  30. package/dist/generator/naming/volterra-mapping.js.map +1 -0
  31. package/dist/generator/openapi-parser.d.ts +339 -0
  32. package/dist/generator/openapi-parser.d.ts.map +1 -0
  33. package/dist/generator/openapi-parser.js +463 -0
  34. package/dist/generator/openapi-parser.js.map +1 -0
  35. package/dist/generator/tool-generator.d.ts +74 -0
  36. package/dist/generator/tool-generator.d.ts.map +1 -0
  37. package/dist/generator/tool-generator.js +387 -0
  38. package/dist/generator/tool-generator.js.map +1 -0
  39. package/dist/generator/transformers/index.d.ts +7 -0
  40. package/dist/generator/transformers/index.d.ts.map +1 -0
  41. package/dist/generator/transformers/index.js +7 -0
  42. package/dist/generator/transformers/index.js.map +1 -0
  43. package/dist/generator/transformers/normalize-examples.d.ts +48 -0
  44. package/dist/generator/transformers/normalize-examples.d.ts.map +1 -0
  45. package/dist/generator/transformers/normalize-examples.js +66 -0
  46. package/dist/generator/transformers/normalize-examples.js.map +1 -0
  47. package/dist/index.d.ts +21 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +70 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/prompts/index.d.ts +6 -0
  52. package/dist/prompts/index.d.ts.map +1 -0
  53. package/dist/prompts/index.js +5 -0
  54. package/dist/prompts/index.js.map +1 -0
  55. package/dist/prompts/workflows.d.ts +59 -0
  56. package/dist/prompts/workflows.d.ts.map +1 -0
  57. package/dist/prompts/workflows.js +585 -0
  58. package/dist/prompts/workflows.js.map +1 -0
  59. package/dist/resources/handlers.d.ts +72 -0
  60. package/dist/resources/handlers.d.ts.map +1 -0
  61. package/dist/resources/handlers.js +279 -0
  62. package/dist/resources/handlers.js.map +1 -0
  63. package/dist/resources/index.d.ts +8 -0
  64. package/dist/resources/index.d.ts.map +1 -0
  65. package/dist/resources/index.js +6 -0
  66. package/dist/resources/index.js.map +1 -0
  67. package/dist/resources/templates.d.ts +86 -0
  68. package/dist/resources/templates.d.ts.map +1 -0
  69. package/dist/resources/templates.js +248 -0
  70. package/dist/resources/templates.js.map +1 -0
  71. package/dist/server.d.ts +78 -0
  72. package/dist/server.d.ts.map +1 -0
  73. package/dist/server.js +426 -0
  74. package/dist/server.js.map +1 -0
  75. package/dist/tools/discovery/consolidate.d.ts +97 -0
  76. package/dist/tools/discovery/consolidate.d.ts.map +1 -0
  77. package/dist/tools/discovery/consolidate.js +200 -0
  78. package/dist/tools/discovery/consolidate.js.map +1 -0
  79. package/dist/tools/discovery/describe.d.ts +132 -0
  80. package/dist/tools/discovery/describe.d.ts.map +1 -0
  81. package/dist/tools/discovery/describe.js +206 -0
  82. package/dist/tools/discovery/describe.js.map +1 -0
  83. package/dist/tools/discovery/execute.d.ts +98 -0
  84. package/dist/tools/discovery/execute.d.ts.map +1 -0
  85. package/dist/tools/discovery/execute.js +251 -0
  86. package/dist/tools/discovery/execute.js.map +1 -0
  87. package/dist/tools/discovery/index-loader.d.ts +28 -0
  88. package/dist/tools/discovery/index-loader.d.ts.map +1 -0
  89. package/dist/tools/discovery/index-loader.js +69 -0
  90. package/dist/tools/discovery/index-loader.js.map +1 -0
  91. package/dist/tools/discovery/index.d.ts +185 -0
  92. package/dist/tools/discovery/index.d.ts.map +1 -0
  93. package/dist/tools/discovery/index.js +177 -0
  94. package/dist/tools/discovery/index.js.map +1 -0
  95. package/dist/tools/discovery/search.d.ts +41 -0
  96. package/dist/tools/discovery/search.d.ts.map +1 -0
  97. package/dist/tools/discovery/search.js +155 -0
  98. package/dist/tools/discovery/search.js.map +1 -0
  99. package/dist/tools/discovery/types.d.ts +70 -0
  100. package/dist/tools/discovery/types.d.ts.map +1 -0
  101. package/dist/tools/discovery/types.js +9 -0
  102. package/dist/tools/discovery/types.js.map +1 -0
  103. package/dist/tools/generated/ai_intelligence/index.d.ts +8 -0
  104. package/dist/tools/generated/ai_intelligence/index.d.ts.map +1 -0
  105. package/dist/tools/generated/ai_intelligence/index.js +282 -0
  106. package/dist/tools/generated/ai_intelligence/index.js.map +1 -0
  107. package/dist/tools/generated/api_security/index.d.ts +8 -0
  108. package/dist/tools/generated/api_security/index.d.ts.map +1 -0
  109. package/dist/tools/generated/api_security/index.js +1852 -0
  110. package/dist/tools/generated/api_security/index.js.map +1 -0
  111. package/dist/tools/generated/applications/index.d.ts +8 -0
  112. package/dist/tools/generated/applications/index.d.ts.map +1 -0
  113. package/dist/tools/generated/applications/index.js +1589 -0
  114. package/dist/tools/generated/applications/index.js.map +1 -0
  115. package/dist/tools/generated/bigip/index.d.ts +8 -0
  116. package/dist/tools/generated/bigip/index.d.ts.map +1 -0
  117. package/dist/tools/generated/bigip/index.js +1173 -0
  118. package/dist/tools/generated/bigip/index.js.map +1 -0
  119. package/dist/tools/generated/billing/index.d.ts +8 -0
  120. package/dist/tools/generated/billing/index.d.ts.map +1 -0
  121. package/dist/tools/generated/billing/index.js +759 -0
  122. package/dist/tools/generated/billing/index.js.map +1 -0
  123. package/dist/tools/generated/cdn/index.d.ts +8 -0
  124. package/dist/tools/generated/cdn/index.d.ts.map +1 -0
  125. package/dist/tools/generated/cdn/index.js +841 -0
  126. package/dist/tools/generated/cdn/index.js.map +1 -0
  127. package/dist/tools/generated/config/index.d.ts +8 -0
  128. package/dist/tools/generated/config/index.d.ts.map +1 -0
  129. package/dist/tools/generated/config/index.js +316 -0
  130. package/dist/tools/generated/config/index.js.map +1 -0
  131. package/dist/tools/generated/identity/index.d.ts +8 -0
  132. package/dist/tools/generated/identity/index.d.ts.map +1 -0
  133. package/dist/tools/generated/identity/index.js +5371 -0
  134. package/dist/tools/generated/identity/index.js.map +1 -0
  135. package/dist/tools/generated/infrastructure/index.d.ts +8 -0
  136. package/dist/tools/generated/infrastructure/index.d.ts.map +1 -0
  137. package/dist/tools/generated/infrastructure/index.js +5342 -0
  138. package/dist/tools/generated/infrastructure/index.js.map +1 -0
  139. package/dist/tools/generated/infrastructure_protection/index.d.ts +8 -0
  140. package/dist/tools/generated/infrastructure_protection/index.d.ts.map +1 -0
  141. package/dist/tools/generated/infrastructure_protection/index.js +2919 -0
  142. package/dist/tools/generated/infrastructure_protection/index.js.map +1 -0
  143. package/dist/tools/generated/integrations/index.d.ts +8 -0
  144. package/dist/tools/generated/integrations/index.d.ts.map +1 -0
  145. package/dist/tools/generated/integrations/index.js +1995 -0
  146. package/dist/tools/generated/integrations/index.js.map +1 -0
  147. package/dist/tools/generated/load_balancer/index.d.ts +8 -0
  148. package/dist/tools/generated/load_balancer/index.d.ts.map +1 -0
  149. package/dist/tools/generated/load_balancer/index.js +2269 -0
  150. package/dist/tools/generated/load_balancer/index.js.map +1 -0
  151. package/dist/tools/generated/networking/index.d.ts +8 -0
  152. package/dist/tools/generated/networking/index.d.ts.map +1 -0
  153. package/dist/tools/generated/networking/index.js +11289 -0
  154. package/dist/tools/generated/networking/index.js.map +1 -0
  155. package/dist/tools/generated/nginx/index.d.ts +8 -0
  156. package/dist/tools/generated/nginx/index.d.ts.map +1 -0
  157. package/dist/tools/generated/nginx/index.js +680 -0
  158. package/dist/tools/generated/nginx/index.js.map +1 -0
  159. package/dist/tools/generated/observability/index.d.ts +8 -0
  160. package/dist/tools/generated/observability/index.d.ts.map +1 -0
  161. package/dist/tools/generated/observability/index.js +6140 -0
  162. package/dist/tools/generated/observability/index.js.map +1 -0
  163. package/dist/tools/generated/operations/index.d.ts +8 -0
  164. package/dist/tools/generated/operations/index.d.ts.map +1 -0
  165. package/dist/tools/generated/operations/index.js +1759 -0
  166. package/dist/tools/generated/operations/index.js.map +1 -0
  167. package/dist/tools/generated/security/index.d.ts +8 -0
  168. package/dist/tools/generated/security/index.d.ts.map +1 -0
  169. package/dist/tools/generated/security/index.js +9111 -0
  170. package/dist/tools/generated/security/index.js.map +1 -0
  171. package/dist/tools/generated/service_mesh/index.d.ts +8 -0
  172. package/dist/tools/generated/service_mesh/index.d.ts.map +1 -0
  173. package/dist/tools/generated/service_mesh/index.js +1628 -0
  174. package/dist/tools/generated/service_mesh/index.js.map +1 -0
  175. package/dist/tools/generated/shape_security/index.d.ts +8 -0
  176. package/dist/tools/generated/shape_security/index.d.ts.map +1 -0
  177. package/dist/tools/generated/shape_security/index.js +4121 -0
  178. package/dist/tools/generated/shape_security/index.js.map +1 -0
  179. package/dist/tools/generated/subscriptions/index.d.ts +8 -0
  180. package/dist/tools/generated/subscriptions/index.d.ts.map +1 -0
  181. package/dist/tools/generated/subscriptions/index.js +778 -0
  182. package/dist/tools/generated/subscriptions/index.js.map +1 -0
  183. package/dist/tools/generated/tenant_management/index.d.ts +8 -0
  184. package/dist/tools/generated/tenant_management/index.d.ts.map +1 -0
  185. package/dist/tools/generated/tenant_management/index.js +2292 -0
  186. package/dist/tools/generated/tenant_management/index.js.map +1 -0
  187. package/dist/tools/generated/vpn/index.d.ts +8 -0
  188. package/dist/tools/generated/vpn/index.d.ts.map +1 -0
  189. package/dist/tools/generated/vpn/index.js +1183 -0
  190. package/dist/tools/generated/vpn/index.js.map +1 -0
  191. package/dist/tools/index.d.ts +7 -0
  192. package/dist/tools/index.d.ts.map +1 -0
  193. package/dist/tools/index.js +6 -0
  194. package/dist/tools/index.js.map +1 -0
  195. package/dist/tools/registry.d.ts +27 -0
  196. package/dist/tools/registry.d.ts.map +1 -0
  197. package/dist/tools/registry.js +83 -0
  198. package/dist/tools/registry.js.map +1 -0
  199. package/dist/utils/error-handling.d.ts +109 -0
  200. package/dist/utils/error-handling.d.ts.map +1 -0
  201. package/dist/utils/error-handling.js +239 -0
  202. package/dist/utils/error-handling.js.map +1 -0
  203. package/dist/utils/index.d.ts +7 -0
  204. package/dist/utils/index.d.ts.map +1 -0
  205. package/dist/utils/index.js +6 -0
  206. package/dist/utils/index.js.map +1 -0
  207. package/dist/utils/logging.d.ts +75 -0
  208. package/dist/utils/logging.d.ts.map +1 -0
  209. package/dist/utils/logging.js +131 -0
  210. package/dist/utils/logging.js.map +1 -0
  211. package/manifest.json +143 -0
  212. package/package.json +95 -0
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Resource Consolidation Module
3
+ *
4
+ * Provides a resource-centric view of tools by grouping CRUD operations.
5
+ * This reduces cognitive load for LLMs by presenting one tool per resource
6
+ * instead of 5 separate CRUD tools.
7
+ *
8
+ * Example:
9
+ * Before: f5xc-api-waap-http-loadbalancer-{create,get,list,update,delete}
10
+ * After: f5xc-api-waap-http-loadbalancer (with operation parameter)
11
+ */
12
+ import { getToolIndex } from "./index-loader.js";
13
+ // Cache for consolidated index
14
+ let consolidatedCache = null;
15
+ /**
16
+ * Standard CRUD operations
17
+ */
18
+ const CRUD_OPERATIONS = ["create", "get", "list", "update", "delete"];
19
+ /**
20
+ * Generate consolidated resource name from tool name
21
+ */
22
+ function getResourceKey(tool) {
23
+ return `${tool.domain}/${tool.resource}`;
24
+ }
25
+ /**
26
+ * Generate consolidated tool name from domain and resource
27
+ */
28
+ function getConsolidatedName(domain, resource) {
29
+ return `f5xc-api-${domain}-${resource}`;
30
+ }
31
+ /**
32
+ * Build consolidated index from tool index
33
+ */
34
+ export function getConsolidatedIndex() {
35
+ if (consolidatedCache) {
36
+ return consolidatedCache;
37
+ }
38
+ const toolIndex = getToolIndex();
39
+ const resourceMap = new Map();
40
+ const standalone = [];
41
+ // Group tools by resource
42
+ for (const tool of toolIndex.tools) {
43
+ const op = tool.operation;
44
+ // Check if this is a standard CRUD operation
45
+ if (CRUD_OPERATIONS.includes(op)) {
46
+ const key = getResourceKey(tool);
47
+ if (!resourceMap.has(key)) {
48
+ resourceMap.set(key, new Map());
49
+ }
50
+ resourceMap.get(key).set(op, tool);
51
+ }
52
+ else {
53
+ // Non-CRUD operation - keep as standalone
54
+ standalone.push(tool);
55
+ }
56
+ }
57
+ // Build consolidated resources
58
+ const resources = [];
59
+ for (const [, opMap] of resourceMap) {
60
+ const operations = Array.from(opMap.keys()).sort();
61
+ const firstTool = opMap.values().next().value;
62
+ // Build tool map for routing
63
+ const toolMap = {};
64
+ for (const [op, tool] of opMap) {
65
+ toolMap[op] = tool.name;
66
+ }
67
+ // Generate combined summary from resource name
68
+ const summary = `Manage ${firstTool.resource} resources. Operations: ${operations.join(", ")}`;
69
+ resources.push({
70
+ name: getConsolidatedName(firstTool.domain, firstTool.resource),
71
+ domain: firstTool.domain,
72
+ resource: firstTool.resource,
73
+ operations,
74
+ summary,
75
+ toolMap,
76
+ isFullCrud: operations.length >= 4, // At least CRUD (no update sometimes)
77
+ });
78
+ }
79
+ // Sort resources by name
80
+ resources.sort((a, b) => a.name.localeCompare(b.name));
81
+ const fullCrudCount = resources.filter((r) => r.isFullCrud).length;
82
+ consolidatedCache = {
83
+ totalResources: resources.length,
84
+ fullCrudResources: fullCrudCount,
85
+ partialResources: resources.length - fullCrudCount,
86
+ standaloneTools: standalone.length,
87
+ resources,
88
+ standalone,
89
+ };
90
+ return consolidatedCache;
91
+ }
92
+ /**
93
+ * Clear consolidated index cache
94
+ */
95
+ export function clearConsolidatedCache() {
96
+ consolidatedCache = null;
97
+ }
98
+ /**
99
+ * Get consolidated resource by name
100
+ */
101
+ export function getConsolidatedResource(name) {
102
+ const index = getConsolidatedIndex();
103
+ return index.resources.find((r) => r.name === name);
104
+ }
105
+ /**
106
+ * Get consolidated resources by domain
107
+ */
108
+ export function getConsolidatedByDomain(domain) {
109
+ const index = getConsolidatedIndex();
110
+ return index.resources.filter((r) => r.domain.toLowerCase() === domain.toLowerCase());
111
+ }
112
+ /**
113
+ * Search consolidated resources with natural language query
114
+ */
115
+ export function searchConsolidatedResources(query, options = {}) {
116
+ const { limit = 10, domains } = options;
117
+ const index = getConsolidatedIndex();
118
+ // Tokenize query
119
+ const queryTerms = query
120
+ .toLowerCase()
121
+ .split(/[\s-_]+/)
122
+ .filter((t) => t.length > 1);
123
+ const results = [];
124
+ for (const resource of index.resources) {
125
+ // Apply domain filter
126
+ if (domains && domains.length > 0) {
127
+ if (!domains.some((d) => d.toLowerCase() === resource.domain.toLowerCase())) {
128
+ continue;
129
+ }
130
+ }
131
+ // Score based on term matching
132
+ const searchableText = [
133
+ resource.name,
134
+ resource.domain,
135
+ resource.resource,
136
+ resource.summary,
137
+ ...resource.operations,
138
+ ]
139
+ .join(" ")
140
+ .toLowerCase();
141
+ const matchedTerms = [];
142
+ let score = 0;
143
+ for (const term of queryTerms) {
144
+ if (searchableText.includes(term)) {
145
+ matchedTerms.push(term);
146
+ // Weight by where the match occurred
147
+ if (resource.resource.toLowerCase().includes(term)) {
148
+ score += 0.4;
149
+ }
150
+ else if (resource.domain.toLowerCase().includes(term)) {
151
+ score += 0.3;
152
+ }
153
+ else if (resource.operations.some((op) => op.includes(term))) {
154
+ score += 0.2;
155
+ }
156
+ else {
157
+ score += 0.1;
158
+ }
159
+ }
160
+ }
161
+ // Normalize score
162
+ if (queryTerms.length > 0) {
163
+ score = score / queryTerms.length;
164
+ }
165
+ if (score > 0) {
166
+ results.push({ resource, score: Math.min(score, 1), matchedTerms });
167
+ }
168
+ }
169
+ // Sort by score descending
170
+ results.sort((a, b) => b.score - a.score);
171
+ return results.slice(0, limit);
172
+ }
173
+ /**
174
+ * Resolve a consolidated resource + operation to the underlying tool name
175
+ */
176
+ export function resolveConsolidatedTool(resourceName, operation) {
177
+ const resource = getConsolidatedResource(resourceName);
178
+ if (!resource) {
179
+ return null;
180
+ }
181
+ return resource.toolMap[operation] ?? null;
182
+ }
183
+ /**
184
+ * Get consolidation statistics
185
+ */
186
+ export function getConsolidationStats() {
187
+ const index = getConsolidatedIndex();
188
+ const toolIndex = getToolIndex();
189
+ const originalToolCount = toolIndex.tools.length;
190
+ const consolidatedCount = index.totalResources + index.standaloneTools;
191
+ const reduction = originalToolCount - consolidatedCount;
192
+ const reductionPercent = ((reduction / originalToolCount) * 100).toFixed(1);
193
+ return {
194
+ originalToolCount,
195
+ consolidatedCount,
196
+ reduction,
197
+ reductionPercent: `${reductionPercent}%`,
198
+ };
199
+ }
200
+ //# sourceMappingURL=consolidate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consolidate.js","sourceRoot":"","sources":["../../../src/tools/discovery/consolidate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA6CjD,+BAA+B;AAC/B,IAAI,iBAAiB,GAA6B,IAAI,CAAC;AAEvD;;GAEG;AACH,MAAM,eAAe,GAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEvF;;GAEG;AACH,SAAS,c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jB,iBAAiB;QACjB,SAAS;QACT,gBAAgB,EAAE,GAAG,gBAAgB,GAAG;KACzC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,132 @@
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
+ */
127
+ export declare function getOptimizationStats(): {
128
+ avgOriginalParamDescLen: number;
129
+ avgOptimizedParamDescLen: number;
130
+ estimatedSavingsPercent: string;
131
+ };
132
+ //# 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;;;G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B,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAqBA;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,EAAE,EAAE,KAAK,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACrC,EAAE,EAAE,KAAK,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACrC,EAAE,EAAE,OAAO,CAAC;CACb;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI,CAoBnF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI;IACtC,uBAAuB,EAAE,MAAM,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC;IACjC,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAgCA"}
@@ -0,0 +1,206 @@
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 } 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
+ */
177
+ export function getOptimizationStats() {
178
+ // Sample a few tools to estimate savings
179
+ const sampleTools = [
180
+ "f5xc-api-loadbalancer-forward-proxy-policy-create",
181
+ "f5xc-api-loadbalancer-forward-proxy-policy-list",
182
+ "f5xc-api-networking-network-interface-create",
183
+ ];
184
+ let originalTotal = 0;
185
+ let optimizedTotal = 0;
186
+ let count = 0;
187
+ for (const name of sampleTools) {
188
+ const tool = getToolByName(name);
189
+ if (tool) {
190
+ for (const param of tool.pathParameters) {
191
+ originalTotal += (param.description ?? "").length;
192
+ optimizedTotal += optimizeDescription(param.name, param.description ?? "").length;
193
+ count++;
194
+ }
195
+ }
196
+ }
197
+ const avgOriginal = count > 0 ? Math.round(originalTotal / count) : 0;
198
+ const avgOptimized = count > 0 ? Math.round(optimizedTotal / count) : 0;
199
+ const savings = avgOriginal > 0 ? ((avgOriginal - avgOptimized) / avgOriginal) * 100 : 0;
200
+ return {
201
+ avgOriginalParamDescLen: avgOriginal,
202
+ avgOptimizedParamDescLen: avgOptimized,
203
+ estimatedSavingsPercent: `${savings.toFixed(1)}%`,
204
+ };
205
+ }
206
+ //# 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,MAAM,mBAAmB,CAAC;AA6C7D;;;GAGG;AACH,M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;IACtE,MAAM,YAAY,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,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,98 @@
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
+ /** f5xcctl CLI equivalent command */
56
+ f5xcctlCommand: string;
57
+ /** Terraform resource example (if applicable) */
58
+ terraformExample?: string;
59
+ /** curl command example */
60
+ curlExample: string;
61
+ /** Message about authentication */
62
+ authMessage: string;
63
+ }
64
+ /**
65
+ * Execute a tool by name with the given parameters
66
+ *
67
+ * In authenticated mode: Makes the actual API call
68
+ * In documentation mode: Returns CLI equivalents and examples
69
+ *
70
+ * @param params - Execution parameters
71
+ * @param credentialManager - Optional credential manager for auth
72
+ * @returns Execution result or documentation
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * // Execute in authenticated mode
77
+ * const result = await executeTool({
78
+ * toolName: "f5xc-api-waap-http-loadbalancer-list",
79
+ * pathParams: { namespace: "default" }
80
+ * }, credentialManager);
81
+ *
82
+ * // Execute in documentation mode (no credentials)
83
+ * const docs = await executeTool({
84
+ * toolName: "f5xc-api-waap-http-loadbalancer-create",
85
+ * pathParams: { "metadata.namespace": "default" },
86
+ * body: { metadata: { name: "example-lb" }, spec: { ... } }
87
+ * });
88
+ * ```
89
+ */
90
+ export declare function executeTool(params: ExecuteToolParams, credentialManager?: CredentialManager): Promise<ExecuteToolResult | DocumentationResponse>;
91
+ /**
92
+ * Validate execution parameters before running
93
+ */
94
+ export declare function validateExecuteParams(toolName: string, params: ExecuteToolParams): {
95
+ valid: boolean;
96
+ errors: string[];
97
+ };
98
+ //# 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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