@atlaskit/ads-mcp 0.7.2 → 0.8.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 (36) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +63 -2
  3. package/dist/cjs/helpers/analytics.js +98 -0
  4. package/dist/cjs/index.js +142 -28
  5. package/dist/cjs/tools/analyze-a11y/index.js +38 -38
  6. package/dist/cjs/tools/get-a11y-guidelines/index.js +4 -4
  7. package/dist/cjs/tools/get-all-icons/index.js +1 -1
  8. package/dist/cjs/tools/get-all-tokens/index.js +1 -1
  9. package/dist/cjs/tools/get-components/components.js +2 -2
  10. package/dist/cjs/tools/get-components/index.js +1 -1
  11. package/dist/cjs/tools/plan/index.js +6 -6
  12. package/dist/cjs/tools/search-components/index.js +9 -9
  13. package/dist/cjs/tools/search-icons/index.js +9 -9
  14. package/dist/cjs/tools/search-tokens/index.js +5 -5
  15. package/dist/cjs/tools/suggest-a11y-fixes/index.js +4 -4
  16. package/dist/es2019/helpers/analytics.js +88 -0
  17. package/dist/es2019/index.js +118 -15
  18. package/dist/es2019/tools/get-components/components.js +2 -2
  19. package/dist/esm/helpers/analytics.js +90 -0
  20. package/dist/esm/index.js +143 -29
  21. package/dist/esm/tools/analyze-a11y/index.js +38 -38
  22. package/dist/esm/tools/get-a11y-guidelines/index.js +4 -4
  23. package/dist/esm/tools/get-all-icons/index.js +1 -1
  24. package/dist/esm/tools/get-all-tokens/index.js +1 -1
  25. package/dist/esm/tools/get-components/components.js +2 -2
  26. package/dist/esm/tools/get-components/index.js +1 -1
  27. package/dist/esm/tools/plan/index.js +6 -6
  28. package/dist/esm/tools/search-components/index.js +9 -9
  29. package/dist/esm/tools/search-icons/index.js +9 -9
  30. package/dist/esm/tools/search-tokens/index.js +5 -5
  31. package/dist/esm/tools/suggest-a11y-fixes/index.js +4 -4
  32. package/dist/types/helpers/analytics.d.ts +28 -0
  33. package/dist/types/tools/get-components/components.d.ts +1 -1
  34. package/dist/types-ts4.5/helpers/analytics.d.ts +28 -0
  35. package/dist/types-ts4.5/tools/get-components/components.d.ts +1 -1
  36. package/package.json +4 -1
package/dist/esm/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- /* eslint-disable import/extensions */
3
+ /* eslint-disable no-console, import/extensions */
4
4
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
5
5
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
- import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
6
+ import { CallToolRequestSchema, ListToolsRequestSchema, McpError } from '@modelcontextprotocol/sdk/types.js';
7
+ import { sendOperationalEvent } from './helpers/analytics';
7
8
  import { instructions } from './instructions';
8
9
  import { analyzeA11yTool, analyzeLocalhostA11yTool, listAnalyzeA11yTool, listAnalyzeLocalhostA11yTool } from './tools/analyze-a11y';
9
10
  import { getA11yGuidelinesTool, listGetA11yGuidelinesTool } from './tools/get-a11y-guidelines';
@@ -24,29 +25,68 @@ var server = new Server({
24
25
  }, {
25
26
  instructions: instructions,
26
27
  capabilities: {
28
+ // logging: {}, // NOTE: We do not have logging enabled as it's not implemented consistently in MCP specs
27
29
  // Tools are defined in the handlers below.
28
30
  tools: {}
29
31
  }
30
32
  });
31
- server.setRequestHandler(ListToolsRequestSchema, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
32
- return _regeneratorRuntime.wrap(function _callee$(_context) {
33
- while (1) switch (_context.prev = _context.next) {
34
- case 0:
35
- return _context.abrupt("return", {
36
- tools: [listAnalyzeA11yTool, listAnalyzeLocalhostA11yTool, listGetA11yGuidelinesTool, listGetAllIconsTool, listGetAllTokensTool, listGetComponentsTool, listPlanTool,
33
+ var generateLogger = function generateLogger(level) {
34
+ return function () {
35
+ // NOTE: We do not have logging enabled as it's not implemented consistently in MCP specs
36
+ // server.sendLoggingMessage({
37
+ // level,
38
+ // data: args,
39
+ // });
40
+
41
+ // Log to console if ADSMCP_DEBUG is set to true
42
+ // using console.error since the only one that works for logging is `stderr`
43
+ // using console.log / other console.fn that use `stdout` will cause an error
44
+ // ref: https://www.mcpevals.io/blog/debugging-mcp-servers-tips-and-best-practices
45
+ if (String(process.env.ADSMCP_DEBUG) === 'true') {
46
+ var _console;
47
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
+ args[_key] = arguments[_key];
49
+ }
50
+ (_console = console).error.apply(_console, ["[ads-mcp.custom-logging][".concat(level, "]")].concat(args));
51
+ }
52
+ };
53
+ };
54
+ server.setRequestHandler(ListToolsRequestSchema, /*#__PURE__*/function () {
55
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(request, extra) {
56
+ var tools;
57
+ return _regeneratorRuntime.wrap(function (_context) {
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ tools = [listAnalyzeA11yTool, listAnalyzeLocalhostA11yTool, listGetA11yGuidelinesTool, listGetAllIconsTool, listGetAllTokensTool, listGetComponentsTool, listPlanTool,
37
61
  // NOTE: These are disabled as `ads_plan` should cover everything more performantly.
38
62
  // When these are enabled, they result in token usage to describe them, even if never used.
39
63
  // listSearchComponentsTool,
40
64
  // listSearchIconsTool,
41
65
  // listSearchTokensTool,
42
- listSuggestA11yFixesTool]
43
- });
44
- case 1:
45
- case "end":
46
- return _context.stop();
47
- }
48
- }, _callee);
49
- })));
66
+ listSuggestA11yFixesTool]; // Track list tools request
67
+ sendOperationalEvent({
68
+ action: 'listed',
69
+ actionSubject: 'ads.mcp.listTools',
70
+ attributes: {
71
+ toolsCount: tools.length,
72
+ // Number of available tools
73
+ request: request,
74
+ extra: extra
75
+ }
76
+ });
77
+ return _context.abrupt("return", {
78
+ tools: tools
79
+ });
80
+ case 1:
81
+ case "end":
82
+ return _context.stop();
83
+ }
84
+ }, _callee);
85
+ }));
86
+ return function (_x, _x2) {
87
+ return _ref.apply(this, arguments);
88
+ };
89
+ }());
50
90
  var callTools = {
51
91
  ads_analyze_a11y: analyzeA11yTool,
52
92
  ads_analyze_localhost_a11y: analyzeLocalhostA11yTool,
@@ -65,26 +105,87 @@ var callTools = {
65
105
 
66
106
  // Handle tool execution
67
107
  server.setRequestHandler(CallToolRequestSchema, /*#__PURE__*/function () {
68
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(request) {
69
- var tool;
70
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
108
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(request, extra) {
109
+ var toolName, tool, actionSubject, result, _t;
110
+ return _regeneratorRuntime.wrap(function (_context2) {
71
111
  while (1) switch (_context2.prev = _context2.next) {
72
112
  case 0:
73
- tool = callTools[request.params.name];
113
+ toolName = request.params.name;
114
+ tool = callTools[toolName];
115
+ actionSubject = "ads.mcp.callTool"; // Track call tool request
116
+ sendOperationalEvent({
117
+ action: 'called',
118
+ actionSubject: actionSubject,
119
+ actionSubjectId: toolName,
120
+ attributes: {
121
+ toolName: toolName,
122
+ request: request,
123
+ extra: extra
124
+ }
125
+ });
74
126
  if (!tool) {
75
- _context2.next = 3;
127
+ _context2.next = 4;
76
128
  break;
77
129
  }
78
- return _context2.abrupt("return", tool(request.params.arguments));
130
+ _context2.prev = 1;
131
+ _context2.next = 2;
132
+ return tool(request.params.arguments);
133
+ case 2:
134
+ result = _context2.sent;
135
+ // Track successful tool execution
136
+ sendOperationalEvent({
137
+ action: 'succeeded',
138
+ actionSubject: actionSubject,
139
+ actionSubjectId: toolName,
140
+ attributes: {
141
+ toolName: toolName,
142
+ request: request,
143
+ extra: extra
144
+ }
145
+ });
146
+ return _context2.abrupt("return", result);
79
147
  case 3:
80
- throw new Error("Tool '".concat(request.params.name, "' not found, only the following tools are available: ").concat(Object.keys(callTools).join(', ')));
148
+ _context2.prev = 3;
149
+ _t = _context2["catch"](1);
150
+ // Track tool execution error
151
+ sendOperationalEvent({
152
+ action: 'failed',
153
+ actionSubject: actionSubject,
154
+ actionSubjectId: toolName,
155
+ attributes: {
156
+ toolName: toolName,
157
+ request: request,
158
+ extra: extra,
159
+ errorMessage: _t instanceof Error ? _t.message : 'Unknown error'
160
+ }
161
+ });
162
+
163
+ /* Throwing an MCP error will cause the MCP server to return an error response to the client.
164
+ We don't use console.error here:
165
+ - when used alone, without the throw new McpError, it causes "Client error for command...", which will loop back to this catch
166
+ */
167
+ throw new McpError(-32000, "Failed to execute '".concat(toolName, "' tool: ").concat(_t instanceof Error ? _t.message : 'Unknown error'));
81
168
  case 4:
169
+ // Track tool not found error
170
+ sendOperationalEvent({
171
+ action: 'notFound',
172
+ actionSubject: actionSubject,
173
+ actionSubjectId: toolName,
174
+ attributes: {
175
+ toolName: toolName,
176
+ request: request,
177
+ extra: extra
178
+ }
179
+ });
180
+ console.error("Tool '".concat(request.params.name, "' not found, only the following tools are available: ").concat(Object.keys(callTools).join(', ')));
181
+ return _context2.abrupt("return");
182
+ case 5:
82
183
  case "end":
83
184
  return _context2.stop();
84
185
  }
85
- }, _callee2);
186
+ }, _callee2, null, [[1, 3]]);
86
187
  }));
87
- return function (_x) {
188
+ return function (_x3, _x4) {
88
189
  return _ref2.apply(this, arguments);
89
190
  };
90
191
  }());
@@ -94,13 +195,25 @@ function runServer() {
94
195
  function _runServer() {
95
196
  _runServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
96
197
  var transport;
97
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
198
+ return _regeneratorRuntime.wrap(function (_context3) {
98
199
  while (1) switch (_context3.prev = _context3.next) {
99
200
  case 0:
201
+ /**
202
+ * We force all logging to go through the MCP server to avoid breaking the MCP.
203
+ */
204
+ console.log = generateLogger('info');
205
+ console.debug = generateLogger('debug');
206
+ console.warn = generateLogger('warning');
207
+
208
+ // Track server initialization
209
+ sendOperationalEvent({
210
+ action: 'initialized',
211
+ actionSubject: 'ads.mcp.initialize'
212
+ });
100
213
  transport = new StdioServerTransport();
101
- _context3.next = 3;
214
+ _context3.next = 1;
102
215
  return server.connect(transport);
103
- case 3:
216
+ case 1:
104
217
  case "end":
105
218
  return _context3.stop();
106
219
  }
@@ -109,5 +222,6 @@ function _runServer() {
109
222
  return _runServer.apply(this, arguments);
110
223
  }
111
224
  runServer().catch(function (error) {
112
- throw new Error("Invalid input to ads-mcp: ".concat(JSON.stringify(error.errors)));
225
+ var errorMessage = error instanceof Error ? error.message : 'Unknown error';
226
+ console.error("Invalid input to ads-mcp: ".concat(errorMessage));
113
227
  });
@@ -145,20 +145,20 @@ function generateADSFixForViolation(violation) {
145
145
  }
146
146
  export var analyzeA11yTool = /*#__PURE__*/function () {
147
147
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
148
- var code, componentName, context, _params$includePatter, includePatternAnalysis, violations, suggestions, axeResults, _axeResults$violation, _axeResults$passes, _axeResults$incomplet, results, adsViolations, relevantGuidelines, summary;
149
- return _regeneratorRuntime.wrap(function _callee$(_context) {
148
+ var code, componentName, context, _params$includePatter, includePatternAnalysis, violations, suggestions, axeResults, _axeResults$violation, _axeResults$passes, _axeResults$incomplet, results, adsViolations, relevantGuidelines, summary, _t;
149
+ return _regeneratorRuntime.wrap(function (_context) {
150
150
  while (1) switch (_context.prev = _context.next) {
151
151
  case 0:
152
152
  code = params.code, componentName = params.componentName, context = params.context, _params$includePatter = params.includePatternAnalysis, includePatternAnalysis = _params$includePatter === void 0 ? true : _params$includePatter;
153
153
  violations = [];
154
154
  suggestions = [];
155
155
  axeResults = {};
156
- _context.prev = 4;
157
- _context.next = 7;
156
+ _context.prev = 1;
157
+ _context.next = 2;
158
158
  return axe.run({
159
159
  fromFrames: ['iframe', 'html']
160
160
  });
161
- case 7:
161
+ case 2:
162
162
  results = _context.sent;
163
163
  // Process axe-core results
164
164
  if (results.violations && results.violations.length > 0) {
@@ -244,9 +244,9 @@ export var analyzeA11yTool = /*#__PURE__*/function () {
244
244
  }, null, 2)
245
245
  }]
246
246
  });
247
- case 20:
248
- _context.prev = 20;
249
- _context.t0 = _context["catch"](4);
247
+ case 3:
248
+ _context.prev = 3;
249
+ _t = _context["catch"](1);
250
250
  // Fallback to pattern-based analysis if axe-core fails
251
251
  // console.warn('Axe-core analysis failed, falling back to pattern analysis:', error);
252
252
 
@@ -295,11 +295,11 @@ export var analyzeA11yTool = /*#__PURE__*/function () {
295
295
  }, null, 2)
296
296
  }]
297
297
  });
298
- case 24:
298
+ case 4:
299
299
  case "end":
300
300
  return _context.stop();
301
301
  }
302
- }, _callee, null, [[4, 20]]);
302
+ }, _callee, null, [[1, 3]]);
303
303
  }));
304
304
  return function analyzeA11yTool(_x) {
305
305
  return _ref.apply(this, arguments);
@@ -307,59 +307,59 @@ export var analyzeA11yTool = /*#__PURE__*/function () {
307
307
  }();
308
308
  export var analyzeLocalhostA11yTool = /*#__PURE__*/function () {
309
309
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
310
- var url, componentName, context, selector, violations, suggestions, axeResults, browser, page, _axeResults$violation2, _axeResults$passes2, _axeResults$incomplet2, elementExists, availableElements, axePuppeteer, results, adsViolations, relevantGuidelines, summary;
311
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
310
+ var url, componentName, context, selector, violations, suggestions, axeResults, browser, page, _axeResults$violation2, _axeResults$passes2, _axeResults$incomplet2, elementExists, availableElements, axePuppeteer, results, adsViolations, relevantGuidelines, summary, _t2;
311
+ return _regeneratorRuntime.wrap(function (_context2) {
312
312
  while (1) switch (_context2.prev = _context2.next) {
313
313
  case 0:
314
314
  url = params.url, componentName = params.componentName, context = params.context, selector = params.selector;
315
315
  violations = [];
316
316
  suggestions = [];
317
317
  axeResults = {};
318
- _context2.next = 6;
318
+ _context2.next = 1;
319
319
  return puppeteer.launch();
320
- case 6:
320
+ case 1:
321
321
  browser = _context2.sent;
322
- _context2.next = 9;
322
+ _context2.next = 2;
323
323
  return browser.newPage();
324
- case 9:
324
+ case 2:
325
325
  page = _context2.sent;
326
- _context2.prev = 10;
327
- _context2.next = 13;
326
+ _context2.prev = 3;
327
+ _context2.next = 4;
328
328
  return page.goto(url, {
329
329
  waitUntil: 'networkidle0'
330
330
  });
331
- case 13:
331
+ case 4:
332
332
  if (!selector) {
333
- _context2.next = 22;
333
+ _context2.next = 7;
334
334
  break;
335
335
  }
336
- _context2.next = 16;
336
+ _context2.next = 5;
337
337
  return page.$(selector);
338
- case 16:
338
+ case 5:
339
339
  elementExists = _context2.sent;
340
340
  if (elementExists) {
341
- _context2.next = 22;
341
+ _context2.next = 7;
342
342
  break;
343
343
  }
344
- _context2.next = 20;
344
+ _context2.next = 6;
345
345
  return page.evaluate(function () {
346
346
  var elements = Array.from(document.querySelectorAll('[id]'));
347
347
  return elements.map(function (el) {
348
348
  return "#".concat(el.id);
349
349
  });
350
350
  });
351
- case 20:
351
+ case 6:
352
352
  availableElements = _context2.sent;
353
353
  throw new Error("Element with selector \"".concat(selector, "\" not found on the page after waiting. Available elements: ").concat(availableElements.join(', ')));
354
- case 22:
354
+ case 7:
355
355
  // Run axe-core accessibility analysis
356
356
  axePuppeteer = new AxePuppeteer(page); // If selector is provided, analyze only that element
357
357
  if (selector) {
358
358
  axePuppeteer.include(selector);
359
359
  }
360
- _context2.next = 26;
360
+ _context2.next = 8;
361
361
  return axePuppeteer.analyze();
362
- case 26:
362
+ case 8:
363
363
  results = _context2.sent;
364
364
  if (results.violations && results.violations.length > 0) {
365
365
  adsViolations = mapAxeViolationsToADSFixes(results.violations);
@@ -415,9 +415,9 @@ export var analyzeLocalhostA11yTool = /*#__PURE__*/function () {
415
415
  incomplete: ((_axeResults$incomplet2 = axeResults.incomplete) === null || _axeResults$incomplet2 === void 0 ? void 0 : _axeResults$incomplet2.length) || 0
416
416
  }
417
417
  };
418
- _context2.next = 37;
418
+ _context2.next = 9;
419
419
  return browser.close();
420
- case 37:
420
+ case 9:
421
421
  return _context2.abrupt("return", {
422
422
  content: [{
423
423
  type: 'text',
@@ -431,12 +431,12 @@ export var analyzeLocalhostA11yTool = /*#__PURE__*/function () {
431
431
  }, null, 2)
432
432
  }]
433
433
  });
434
- case 40:
435
- _context2.prev = 40;
436
- _context2.t0 = _context2["catch"](10);
437
- _context2.next = 44;
434
+ case 10:
435
+ _context2.prev = 10;
436
+ _t2 = _context2["catch"](3);
437
+ _context2.next = 11;
438
438
  return browser.close();
439
- case 44:
439
+ case 11:
440
440
  return _context2.abrupt("return", {
441
441
  content: [{
442
442
  type: 'text',
@@ -459,16 +459,16 @@ export var analyzeLocalhostA11yTool = /*#__PURE__*/function () {
459
459
  },
460
460
  violations: violations,
461
461
  suggestions: [],
462
- error: String(_context2.t0),
462
+ error: String(_t2),
463
463
  recommendations: ['Use ADS components for better accessibility out of the box', 'Reference https://atlassian.design/llms-a11y.txt for detailed guidelines', 'Test with keyboard navigation and screen readers', 'Use automated accessibility testing tools']
464
464
  }, null, 2)
465
465
  }]
466
466
  });
467
- case 45:
467
+ case 12:
468
468
  case "end":
469
469
  return _context2.stop();
470
470
  }
471
- }, _callee2, null, [[10, 40]]);
471
+ }, _callee2, null, [[3, 10]]);
472
472
  }));
473
473
  return function analyzeLocalhostA11yTool(_x2) {
474
474
  return _ref2.apply(this, arguments);
@@ -25,12 +25,12 @@ export var listGetA11yGuidelinesTool = {
25
25
  export var getA11yGuidelinesTool = /*#__PURE__*/function () {
26
26
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
27
27
  var topic, guidelines;
28
- return _regeneratorRuntime.wrap(function _callee$(_context) {
28
+ return _regeneratorRuntime.wrap(function (_context) {
29
29
  while (1) switch (_context.prev = _context.next) {
30
30
  case 0:
31
31
  topic = _ref.topic;
32
32
  if (!(topic && accessibilityGuidelines[topic])) {
33
- _context.next = 4;
33
+ _context.next = 1;
34
34
  break;
35
35
  }
36
36
  guidelines = accessibilityGuidelines[topic];
@@ -44,7 +44,7 @@ export var getA11yGuidelinesTool = /*#__PURE__*/function () {
44
44
  }), null, 2)
45
45
  }]
46
46
  });
47
- case 4:
47
+ case 1:
48
48
  return _context.abrupt("return", {
49
49
  content: [{
50
50
  type: 'text',
@@ -56,7 +56,7 @@ export var getA11yGuidelinesTool = /*#__PURE__*/function () {
56
56
  }, null, 2)
57
57
  }]
58
58
  });
59
- case 5:
59
+ case 2:
60
60
  case "end":
61
61
  return _context.stop();
62
62
  }
@@ -33,7 +33,7 @@ export var listGetAllIconsTool = {
33
33
  };
34
34
  export var getAllIconsTool = /*#__PURE__*/function () {
35
35
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
36
- return _regeneratorRuntime.wrap(function _callee$(_context) {
36
+ return _regeneratorRuntime.wrap(function (_context) {
37
37
  while (1) switch (_context.prev = _context.next) {
38
38
  case 0:
39
39
  return _context.abrupt("return", {
@@ -18,7 +18,7 @@ export var listGetAllTokensTool = {
18
18
  };
19
19
  export var getAllTokensTool = /*#__PURE__*/function () {
20
20
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
21
- return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ return _regeneratorRuntime.wrap(function (_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
24
24
  return _context.abrupt("return", {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates TypeScript components data for AI tooling from offerings.json files
5
5
  *
6
- * @codegen <<SignedSource::d39d38cf9fe44e75308cd943349942d1>>
6
+ * @codegen <<SignedSource::1792e8b918fbdc85769f6ddf38970c58>>
7
7
  * @codegenCommand yarn workspace @af/ads-ai-tooling codegen:prototyping
8
8
  */
9
9
 
@@ -1689,7 +1689,7 @@ export var components = [{
1689
1689
  type: '"off" | "on"'
1690
1690
  }, {
1691
1691
  name: 'children',
1692
- description: 'The contents rendered inside of the form. This is a function where the props will be passed from the form. The function props you can access are `dirty`, `submitting` and `disabled`.\n You can read more about these props in [react-final form documentation](https://final-form.org/docs/final-form/types/FormState).',
1692
+ description: 'The contents rendered inside of the form. This is a function where the props will be passed from the form. The function props you can access are `dirty`, `submitting` and `disabled`.\nYou can read more about these props in [react-final form documentation](https://final-form.org/docs/final-form/types/FormState).\n\nIf you are only spreading `formProps` onto the HTML `<form>` element and not using any of the other props (like `submitting`, etc.), `children` can be plain JSX. All of the children will be wrapped within an HTML `<form>` element that includes all necessary props, including those provided on the form component.',
1693
1693
  type: '(() => void) | React.ReactNode | ((args: FormChildrenArgs<FormValues>) => React.ReactNode)'
1694
1694
  }, {
1695
1695
  name: 'formProps',
@@ -17,7 +17,7 @@ export var listGetComponentsTool = {
17
17
  };
18
18
  export var getComponentsTool = /*#__PURE__*/function () {
19
19
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
20
- return _regeneratorRuntime.wrap(function _callee$(_context) {
20
+ return _regeneratorRuntime.wrap(function (_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
23
23
  return _context.abrupt("return", {
@@ -30,12 +30,12 @@ export var listPlanTool = {
30
30
  export var planTool = /*#__PURE__*/function () {
31
31
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
32
32
  var tokens_search, icons_search, components_search, _params$limit, limit, _params$exactName, exactName, results, searchPromises, getResultCount, consolidatedResult;
33
- return _regeneratorRuntime.wrap(function _callee$(_context) {
33
+ return _regeneratorRuntime.wrap(function (_context) {
34
34
  while (1) switch (_context.prev = _context.next) {
35
35
  case 0:
36
36
  tokens_search = params.tokens, icons_search = params.icons, components_search = params.components, _params$limit = params.limit, limit = _params$limit === void 0 ? 1 : _params$limit, _params$exactName = params.exactName, exactName = _params$exactName === void 0 ? false : _params$exactName; // Validate that at least one search type is provided
37
37
  if (!(!(tokens_search !== null && tokens_search !== void 0 && tokens_search.length) && !(icons_search !== null && icons_search !== void 0 && icons_search.length) && !(components_search !== null && components_search !== void 0 && components_search.length))) {
38
- _context.next = 3;
38
+ _context.next = 1;
39
39
  break;
40
40
  }
41
41
  return _context.abrupt("return", {
@@ -45,7 +45,7 @@ export var planTool = /*#__PURE__*/function () {
45
45
  text: 'Error: At least one search type (tokens_search, icons_search, or components_search) must be provided with search terms'
46
46
  }]
47
47
  });
48
- case 3:
48
+ case 1:
49
49
  results = {}; // Execute searches in parallel
50
50
  searchPromises = [];
51
51
  if (tokens_search !== null && tokens_search !== void 0 && tokens_search.length) {
@@ -77,9 +77,9 @@ export var planTool = /*#__PURE__*/function () {
77
77
  }
78
78
 
79
79
  // Wait for all searches to complete
80
- _context.next = 10;
80
+ _context.next = 2;
81
81
  return Promise.all(searchPromises);
82
- case 10:
82
+ case 2:
83
83
  // Helper function to safely count results
84
84
  getResultCount = function getResultCount(result) {
85
85
  var _result$content;
@@ -117,7 +117,7 @@ export var planTool = /*#__PURE__*/function () {
117
117
  text: JSON.stringify(consolidatedResult, null, 2)
118
118
  }]
119
119
  });
120
- case 13:
120
+ case 3:
121
121
  case "end":
122
122
  return _context.stop();
123
123
  }
@@ -35,13 +35,13 @@ var cleanComponentResult = function cleanComponentResult(result) {
35
35
  export var searchComponentsTool = /*#__PURE__*/function () {
36
36
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
37
37
  var terms, _params$limit, limit, _params$exactName, exactName, searchTerms, exactNameMatches, fuse, results, uniqueResults;
38
- return _regeneratorRuntime.wrap(function _callee$(_context) {
38
+ return _regeneratorRuntime.wrap(function (_context) {
39
39
  while (1) switch (_context.prev = _context.next) {
40
40
  case 0:
41
41
  terms = params.terms, _params$limit = params.limit, limit = _params$limit === void 0 ? 1 : _params$limit, _params$exactName = params.exactName, exactName = _params$exactName === void 0 ? false : _params$exactName;
42
42
  searchTerms = terms.filter(Boolean).map(cleanQuery);
43
43
  if (searchTerms.length) {
44
- _context.next = 4;
44
+ _context.next = 1;
45
45
  break;
46
46
  }
47
47
  return _context.abrupt("return", {
@@ -51,9 +51,9 @@ export var searchComponentsTool = /*#__PURE__*/function () {
51
51
  text: "Error: Required parameter 'terms' is missing or empty"
52
52
  }]
53
53
  });
54
- case 4:
54
+ case 1:
55
55
  if (!exactName) {
56
- _context.next = 8;
56
+ _context.next = 2;
57
57
  break;
58
58
  }
59
59
  // for each search term, search for the exact match
@@ -63,7 +63,7 @@ export var searchComponentsTool = /*#__PURE__*/function () {
63
63
  });
64
64
  }).filter(Boolean);
65
65
  if (!(exactNameMatches.length > 0)) {
66
- _context.next = 8;
66
+ _context.next = 2;
67
67
  break;
68
68
  }
69
69
  return _context.abrupt("return", {
@@ -72,7 +72,7 @@ export var searchComponentsTool = /*#__PURE__*/function () {
72
72
  text: JSON.stringify(exactNameMatches.map(cleanComponentResult))
73
73
  }]
74
74
  });
75
- case 8:
75
+ case 2:
76
76
  // use Fuse.js to fuzzy-search through the components
77
77
  fuse = new Fuse(components, {
78
78
  keys: [{
@@ -106,7 +106,7 @@ export var searchComponentsTool = /*#__PURE__*/function () {
106
106
  return fuse.search(term).slice(0, limit);
107
107
  }).flat();
108
108
  if (results.length) {
109
- _context.next = 12;
109
+ _context.next = 3;
110
110
  break;
111
111
  }
112
112
  return _context.abrupt("return", {
@@ -118,7 +118,7 @@ export var searchComponentsTool = /*#__PURE__*/function () {
118
118
  }).join(', '))
119
119
  }]
120
120
  });
121
- case 12:
121
+ case 3:
122
122
  // Remove duplicates based on component name
123
123
  uniqueResults = results.filter(function (result, index, arr) {
124
124
  return arr.findIndex(function (r) {
@@ -133,7 +133,7 @@ export var searchComponentsTool = /*#__PURE__*/function () {
133
133
  }).map(cleanComponentResult))
134
134
  }]
135
135
  });
136
- case 14:
136
+ case 4:
137
137
  case "end":
138
138
  return _context.stop();
139
139
  }