@rainfall-devkit/sdk 0.2.2 → 0.2.4

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 (39) hide show
  1. package/dist/chunk-2FYYTIJQ.mjs +993 -0
  2. package/dist/chunk-6FXRLPLR.mjs +436 -0
  3. package/dist/chunk-CC4O7GSQ.mjs +978 -0
  4. package/dist/chunk-CQ5TV7CQ.mjs +989 -0
  5. package/dist/chunk-GPKQUVAV.mjs +987 -0
  6. package/dist/chunk-LJQEO3CY.mjs +150 -0
  7. package/dist/chunk-S7MOQCV4.mjs +137 -0
  8. package/dist/chunk-XHPFY5MH.mjs +132 -0
  9. package/dist/cli/index.js +1128 -49
  10. package/dist/cli/index.mjs +370 -30
  11. package/dist/daemon/index.d.mts +3 -3
  12. package/dist/daemon/index.d.ts +3 -3
  13. package/dist/daemon/index.js +416 -130
  14. package/dist/daemon/index.mjs +2 -1
  15. package/dist/display-KKJPO6UA.mjs +14 -0
  16. package/dist/errors-CY6HW2I5.mjs +24 -0
  17. package/dist/index.d.mts +66 -4
  18. package/dist/index.d.ts +66 -4
  19. package/dist/index.js +896 -113
  20. package/dist/index.mjs +18 -6
  21. package/dist/listeners-BBNBsJCk.d.ts +372 -0
  22. package/dist/listeners-BCEypw1u.d.ts +372 -0
  23. package/dist/listeners-BGdrWpkP.d.mts +372 -0
  24. package/dist/listeners-CMUKjEkb.d.mts +372 -0
  25. package/dist/listeners-CadPNUHd.d.ts +372 -0
  26. package/dist/listeners-Ckdj6D8T.d.mts +372 -0
  27. package/dist/mcp.d.mts +2 -2
  28. package/dist/mcp.d.ts +2 -2
  29. package/dist/mcp.js +410 -102
  30. package/dist/mcp.mjs +4 -2
  31. package/dist/param-parser-JVKB5FQK.mjs +12 -0
  32. package/dist/param-parser-PAKCNDBX.mjs +136 -0
  33. package/dist/sdk-BUVNdBc7.d.mts +1167 -0
  34. package/dist/sdk-BUVNdBc7.d.ts +1167 -0
  35. package/dist/sdk-Cl5Qzt4I.d.mts +1165 -0
  36. package/dist/sdk-Cl5Qzt4I.d.ts +1165 -0
  37. package/dist/sdk-DQKNbBce.d.mts +1162 -0
  38. package/dist/sdk-DQKNbBce.d.ts +1162 -0
  39. package/package.json +1 -1
package/dist/mcp.js CHANGED
@@ -3,6 +3,9 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __esm = (fn, res) => function __init() {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ };
6
9
  var __export = (target, all) => {
7
10
  for (var name in all)
8
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,113 +20,27 @@ var __copyProps = (to, from, except, desc) => {
17
20
  };
18
21
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
22
 
20
- // src/mcp.ts
21
- var mcp_exports = {};
22
- __export(mcp_exports, {
23
+ // node_modules/tsup/assets/cjs_shims.js
24
+ var init_cjs_shims = __esm({
25
+ "node_modules/tsup/assets/cjs_shims.js"() {
26
+ "use strict";
27
+ }
28
+ });
29
+
30
+ // src/errors.ts
31
+ var errors_exports = {};
32
+ __export(errors_exports, {
23
33
  AuthenticationError: () => AuthenticationError,
24
34
  NetworkError: () => NetworkError,
25
35
  NotFoundError: () => NotFoundError,
26
- Rainfall: () => Rainfall,
27
36
  RainfallError: () => RainfallError,
28
37
  RateLimitError: () => RateLimitError,
29
38
  ServerError: () => ServerError,
30
39
  TimeoutError: () => TimeoutError,
31
40
  ToolNotFoundError: () => ToolNotFoundError,
32
41
  ValidationError: () => ValidationError,
33
- createRainfallMCPServer: () => createRainfallMCPServer,
34
42
  parseErrorResponse: () => parseErrorResponse
35
43
  });
36
- module.exports = __toCommonJS(mcp_exports);
37
-
38
- // src/errors.ts
39
- var RainfallError = class _RainfallError extends Error {
40
- constructor(message, code, statusCode, details) {
41
- super(message);
42
- this.code = code;
43
- this.statusCode = statusCode;
44
- this.details = details;
45
- this.name = "RainfallError";
46
- Object.setPrototypeOf(this, _RainfallError.prototype);
47
- }
48
- toJSON() {
49
- return {
50
- name: this.name,
51
- code: this.code,
52
- message: this.message,
53
- statusCode: this.statusCode,
54
- details: this.details
55
- };
56
- }
57
- };
58
- var AuthenticationError = class _AuthenticationError extends RainfallError {
59
- constructor(message = "Invalid API key", details) {
60
- super(message, "AUTHENTICATION_ERROR", 401, details);
61
- this.name = "AuthenticationError";
62
- Object.setPrototypeOf(this, _AuthenticationError.prototype);
63
- }
64
- };
65
- var RateLimitError = class _RateLimitError extends RainfallError {
66
- retryAfter;
67
- limit;
68
- remaining;
69
- resetAt;
70
- constructor(message = "Rate limit exceeded", retryAfter = 60, limit = 0, remaining = 0, resetAt) {
71
- super(message, "RATE_LIMIT_ERROR", 429, { retryAfter, limit, remaining });
72
- this.name = "RateLimitError";
73
- this.retryAfter = retryAfter;
74
- this.limit = limit;
75
- this.remaining = remaining;
76
- this.resetAt = resetAt || new Date(Date.now() + retryAfter * 1e3);
77
- Object.setPrototypeOf(this, _RateLimitError.prototype);
78
- }
79
- };
80
- var ValidationError = class _ValidationError extends RainfallError {
81
- constructor(message, details) {
82
- super(message, "VALIDATION_ERROR", 400, details);
83
- this.name = "ValidationError";
84
- Object.setPrototypeOf(this, _ValidationError.prototype);
85
- }
86
- };
87
- var NotFoundError = class _NotFoundError extends RainfallError {
88
- constructor(resource, identifier) {
89
- super(
90
- `${resource}${identifier ? ` '${identifier}'` : ""} not found`,
91
- "NOT_FOUND_ERROR",
92
- 404,
93
- { resource, identifier }
94
- );
95
- this.name = "NotFoundError";
96
- Object.setPrototypeOf(this, _NotFoundError.prototype);
97
- }
98
- };
99
- var ServerError = class _ServerError extends RainfallError {
100
- constructor(message = "Internal server error", statusCode = 500) {
101
- super(message, "SERVER_ERROR", statusCode);
102
- this.name = "ServerError";
103
- Object.setPrototypeOf(this, _ServerError.prototype);
104
- }
105
- };
106
- var TimeoutError = class _TimeoutError extends RainfallError {
107
- constructor(timeoutMs) {
108
- super(`Request timed out after ${timeoutMs}ms`, "TIMEOUT_ERROR", 408);
109
- this.name = "TimeoutError";
110
- Object.setPrototypeOf(this, _TimeoutError.prototype);
111
- }
112
- };
113
- var NetworkError = class _NetworkError extends RainfallError {
114
- constructor(message = "Network error", details) {
115
- super(message, "NETWORK_ERROR", void 0, details);
116
- this.name = "NetworkError";
117
- Object.setPrototypeOf(this, _NetworkError.prototype);
118
- }
119
- };
120
- var ToolNotFoundError = class _ToolNotFoundError extends RainfallError {
121
- constructor(toolId) {
122
- super(`Tool '${toolId}' not found`, "TOOL_NOT_FOUND", 404, { toolId });
123
- this.name = "ToolNotFoundError";
124
- Object.setPrototypeOf(this, _ToolNotFoundError.prototype);
125
- }
126
- };
127
44
  function parseErrorResponse(response, data) {
128
45
  const statusCode = response.status;
129
46
  if (statusCode === 429) {
@@ -172,6 +89,287 @@ function parseErrorResponse(response, data) {
172
89
  );
173
90
  }
174
91
  }
92
+ var RainfallError, AuthenticationError, RateLimitError, ValidationError, NotFoundError, ServerError, TimeoutError, NetworkError, ToolNotFoundError;
93
+ var init_errors = __esm({
94
+ "src/errors.ts"() {
95
+ "use strict";
96
+ init_cjs_shims();
97
+ RainfallError = class _RainfallError extends Error {
98
+ constructor(message, code, statusCode, details) {
99
+ super(message);
100
+ this.code = code;
101
+ this.statusCode = statusCode;
102
+ this.details = details;
103
+ this.name = "RainfallError";
104
+ Object.setPrototypeOf(this, _RainfallError.prototype);
105
+ }
106
+ toJSON() {
107
+ return {
108
+ name: this.name,
109
+ code: this.code,
110
+ message: this.message,
111
+ statusCode: this.statusCode,
112
+ details: this.details
113
+ };
114
+ }
115
+ };
116
+ AuthenticationError = class _AuthenticationError extends RainfallError {
117
+ constructor(message = "Invalid API key", details) {
118
+ super(message, "AUTHENTICATION_ERROR", 401, details);
119
+ this.name = "AuthenticationError";
120
+ Object.setPrototypeOf(this, _AuthenticationError.prototype);
121
+ }
122
+ };
123
+ RateLimitError = class _RateLimitError extends RainfallError {
124
+ retryAfter;
125
+ limit;
126
+ remaining;
127
+ resetAt;
128
+ constructor(message = "Rate limit exceeded", retryAfter = 60, limit = 0, remaining = 0, resetAt) {
129
+ super(message, "RATE_LIMIT_ERROR", 429, { retryAfter, limit, remaining });
130
+ this.name = "RateLimitError";
131
+ this.retryAfter = retryAfter;
132
+ this.limit = limit;
133
+ this.remaining = remaining;
134
+ this.resetAt = resetAt || new Date(Date.now() + retryAfter * 1e3);
135
+ Object.setPrototypeOf(this, _RateLimitError.prototype);
136
+ }
137
+ };
138
+ ValidationError = class _ValidationError extends RainfallError {
139
+ constructor(message, details) {
140
+ super(message, "VALIDATION_ERROR", 400, details);
141
+ this.name = "ValidationError";
142
+ Object.setPrototypeOf(this, _ValidationError.prototype);
143
+ }
144
+ };
145
+ NotFoundError = class _NotFoundError extends RainfallError {
146
+ constructor(resource, identifier) {
147
+ super(
148
+ `${resource}${identifier ? ` '${identifier}'` : ""} not found`,
149
+ "NOT_FOUND_ERROR",
150
+ 404,
151
+ { resource, identifier }
152
+ );
153
+ this.name = "NotFoundError";
154
+ Object.setPrototypeOf(this, _NotFoundError.prototype);
155
+ }
156
+ };
157
+ ServerError = class _ServerError extends RainfallError {
158
+ constructor(message = "Internal server error", statusCode = 500) {
159
+ super(message, "SERVER_ERROR", statusCode);
160
+ this.name = "ServerError";
161
+ Object.setPrototypeOf(this, _ServerError.prototype);
162
+ }
163
+ };
164
+ TimeoutError = class _TimeoutError extends RainfallError {
165
+ constructor(timeoutMs) {
166
+ super(`Request timed out after ${timeoutMs}ms`, "TIMEOUT_ERROR", 408);
167
+ this.name = "TimeoutError";
168
+ Object.setPrototypeOf(this, _TimeoutError.prototype);
169
+ }
170
+ };
171
+ NetworkError = class _NetworkError extends RainfallError {
172
+ constructor(message = "Network error", details) {
173
+ super(message, "NETWORK_ERROR", void 0, details);
174
+ this.name = "NetworkError";
175
+ Object.setPrototypeOf(this, _NetworkError.prototype);
176
+ }
177
+ };
178
+ ToolNotFoundError = class _ToolNotFoundError extends RainfallError {
179
+ constructor(toolId) {
180
+ super(`Tool '${toolId}' not found`, "TOOL_NOT_FOUND", 404, { toolId });
181
+ this.name = "ToolNotFoundError";
182
+ Object.setPrototypeOf(this, _ToolNotFoundError.prototype);
183
+ }
184
+ };
185
+ }
186
+ });
187
+
188
+ // src/mcp.ts
189
+ var mcp_exports = {};
190
+ __export(mcp_exports, {
191
+ AuthenticationError: () => AuthenticationError,
192
+ NetworkError: () => NetworkError,
193
+ NotFoundError: () => NotFoundError,
194
+ Rainfall: () => Rainfall,
195
+ RainfallError: () => RainfallError,
196
+ RateLimitError: () => RateLimitError,
197
+ ServerError: () => ServerError,
198
+ TimeoutError: () => TimeoutError,
199
+ ToolNotFoundError: () => ToolNotFoundError,
200
+ ValidationError: () => ValidationError,
201
+ createRainfallMCPServer: () => createRainfallMCPServer,
202
+ parseErrorResponse: () => parseErrorResponse
203
+ });
204
+ module.exports = __toCommonJS(mcp_exports);
205
+ init_cjs_shims();
206
+
207
+ // src/sdk.ts
208
+ init_cjs_shims();
209
+
210
+ // src/client.ts
211
+ init_cjs_shims();
212
+ init_errors();
213
+
214
+ // src/validation.ts
215
+ init_cjs_shims();
216
+ init_errors();
217
+ var schemaCache = /* @__PURE__ */ new Map();
218
+ var CACHE_TTL_MS = 5 * 60 * 1e3;
219
+ async function fetchToolSchema(client, toolId) {
220
+ const cached = schemaCache.get(toolId);
221
+ if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
222
+ return cached.schema;
223
+ }
224
+ const response = await client.request(
225
+ `/olympic/subscribers/me/nodes/${toolId}/params`
226
+ );
227
+ if (!response.success || !response.params) {
228
+ throw new ValidationError(`Failed to fetch schema for tool '${toolId}'`);
229
+ }
230
+ schemaCache.set(toolId, { schema: response.params, timestamp: Date.now() });
231
+ return response.params;
232
+ }
233
+ function validateParams(schema, params, toolId) {
234
+ const errors = [];
235
+ const parameters = schema.parameters || {};
236
+ for (const [key, paramSchema] of Object.entries(parameters)) {
237
+ if (paramSchema.optional !== true && !(key in (params || {}))) {
238
+ errors.push({
239
+ path: key,
240
+ message: `Missing required parameter '${key}'`,
241
+ expected: paramSchema.type
242
+ });
243
+ }
244
+ }
245
+ if (params) {
246
+ for (const [key, value] of Object.entries(params)) {
247
+ const paramSchema = parameters[key];
248
+ if (!paramSchema) {
249
+ errors.push({
250
+ path: key,
251
+ message: `Unknown parameter '${key}'`,
252
+ received: value
253
+ });
254
+ continue;
255
+ }
256
+ const typeError = validateType(key, value, paramSchema);
257
+ if (typeError) {
258
+ errors.push(typeError);
259
+ }
260
+ }
261
+ }
262
+ return {
263
+ valid: errors.length === 0,
264
+ errors
265
+ };
266
+ }
267
+ function validateType(path, value, schema) {
268
+ if (value === null || value === void 0) {
269
+ if (schema.optional === true) {
270
+ return null;
271
+ }
272
+ return {
273
+ path,
274
+ message: `Parameter '${path}' is required but received ${value}`,
275
+ received: value,
276
+ expected: schema.type
277
+ };
278
+ }
279
+ const expectedType = schema.type;
280
+ const actualType = getJsType(value);
281
+ switch (expectedType) {
282
+ case "string":
283
+ if (typeof value !== "string") {
284
+ return {
285
+ path,
286
+ message: `Parameter '${path}' must be a string, received ${actualType}`,
287
+ received: value,
288
+ expected: "string"
289
+ };
290
+ }
291
+ break;
292
+ case "number":
293
+ if (typeof value !== "number" || isNaN(value)) {
294
+ return {
295
+ path,
296
+ message: `Parameter '${path}' must be a number, received ${actualType}`,
297
+ received: value,
298
+ expected: "number"
299
+ };
300
+ }
301
+ break;
302
+ case "boolean":
303
+ if (typeof value !== "boolean") {
304
+ return {
305
+ path,
306
+ message: `Parameter '${path}' must be a boolean, received ${actualType}`,
307
+ received: value,
308
+ expected: "boolean"
309
+ };
310
+ }
311
+ break;
312
+ case "array":
313
+ if (!Array.isArray(value)) {
314
+ return {
315
+ path,
316
+ message: `Parameter '${path}' must be an array, received ${actualType}`,
317
+ received: value,
318
+ expected: "array"
319
+ };
320
+ }
321
+ if (schema.items) {
322
+ for (let i = 0; i < value.length; i++) {
323
+ const itemError = validateType(`${path}[${i}]`, value[i], schema.items);
324
+ if (itemError) {
325
+ return itemError;
326
+ }
327
+ }
328
+ }
329
+ break;
330
+ case "object":
331
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
332
+ return {
333
+ path,
334
+ message: `Parameter '${path}' must be an object, received ${actualType}`,
335
+ received: value,
336
+ expected: "object"
337
+ };
338
+ }
339
+ if (schema.properties) {
340
+ const objValue = value;
341
+ for (const [propKey, propSchema] of Object.entries(schema.properties)) {
342
+ if (objValue[propKey] !== void 0) {
343
+ const propError = validateType(`${path}.${propKey}`, objValue[propKey], propSchema);
344
+ if (propError) {
345
+ return propError;
346
+ }
347
+ }
348
+ }
349
+ }
350
+ break;
351
+ default:
352
+ break;
353
+ }
354
+ return null;
355
+ }
356
+ function getJsType(value) {
357
+ if (value === null) return "null";
358
+ if (Array.isArray(value)) return "array";
359
+ return typeof value;
360
+ }
361
+ function formatValidationErrors(result) {
362
+ if (result.valid) return "No validation errors";
363
+ const lines = result.errors.map((err) => {
364
+ let line = ` - ${err.message}`;
365
+ if (err.received !== void 0) {
366
+ line += ` (received: ${JSON.stringify(err.received).slice(0, 50)})`;
367
+ }
368
+ return line;
369
+ });
370
+ return `Validation failed with ${result.errors.length} error(s):
371
+ ${lines.join("\n")}`;
372
+ }
175
373
 
176
374
  // src/client.ts
177
375
  var DEFAULT_BASE_URL = "https://olympic-api.pragma-digital.org/v1";
@@ -184,6 +382,7 @@ var RainfallClient = class {
184
382
  defaultTimeout;
185
383
  defaultRetries;
186
384
  defaultRetryDelay;
385
+ disableValidation;
187
386
  lastRateLimitInfo;
188
387
  subscriberId;
189
388
  constructor(config) {
@@ -192,6 +391,7 @@ var RainfallClient = class {
192
391
  this.defaultTimeout = config.timeout || DEFAULT_TIMEOUT;
193
392
  this.defaultRetries = config.retries ?? DEFAULT_RETRIES;
194
393
  this.defaultRetryDelay = config.retryDelay || DEFAULT_RETRY_DELAY;
394
+ this.disableValidation = config.disableValidation ?? false;
195
395
  }
196
396
  /**
197
397
  * Get the last rate limit info from the API
@@ -274,15 +474,72 @@ var RainfallClient = class {
274
474
  }
275
475
  /**
276
476
  * Execute a tool/node by ID
477
+ *
478
+ * @param toolId - The ID of the tool/node to execute
479
+ * @param params - Parameters to pass to the tool
480
+ * @param options - Request options including skipValidation to bypass param validation
277
481
  */
278
482
  async executeTool(toolId, params, options) {
483
+ if (!this.disableValidation && !options?.skipValidation) {
484
+ const validation = await this.validateToolParams(toolId, params);
485
+ if (!validation.valid) {
486
+ const { ValidationError: ValidationError2 } = await Promise.resolve().then(() => (init_errors(), errors_exports));
487
+ throw new ValidationError2(
488
+ `Parameter validation failed for tool '${toolId}': ${formatValidationErrors(validation)}`,
489
+ { toolId, errors: validation.errors }
490
+ );
491
+ }
492
+ }
279
493
  const subscriberId = await this.ensureSubscriberId();
494
+ const body = params || {};
495
+ if (options?.targetEdge) {
496
+ body._targetEdge = options.targetEdge;
497
+ }
280
498
  const response = await this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}`, {
281
499
  method: "POST",
282
- body: params || {}
500
+ body
283
501
  }, options);
502
+ if (response.success === false) {
503
+ const errorMessage = typeof response.error === "string" ? response.error : JSON.stringify(response.error);
504
+ throw new RainfallError(
505
+ `Tool execution failed: ${errorMessage}`,
506
+ "TOOL_EXECUTION_ERROR",
507
+ 400,
508
+ { toolId, error: response.error }
509
+ );
510
+ }
284
511
  return response.result;
285
512
  }
513
+ /**
514
+ * Validate parameters for a tool without executing it
515
+ * Fetches the tool schema and validates the provided params
516
+ *
517
+ * @param toolId - The ID of the tool to validate params for
518
+ * @param params - Parameters to validate
519
+ * @returns Validation result with detailed error information
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * const result = await client.validateToolParams('finviz-quotes', { tickers: ['AAPL'] });
524
+ * if (!result.valid) {
525
+ * console.log('Validation errors:', result.errors);
526
+ * }
527
+ * ```
528
+ */
529
+ async validateToolParams(toolId, params) {
530
+ try {
531
+ const schema = await fetchToolSchema(this, toolId);
532
+ return validateParams(schema, params, toolId);
533
+ } catch (error) {
534
+ if (error instanceof RainfallError && error.statusCode === 404) {
535
+ return {
536
+ valid: false,
537
+ errors: [{ path: toolId, message: `Tool '${toolId}' not found` }]
538
+ };
539
+ }
540
+ return { valid: true, errors: [] };
541
+ }
542
+ }
286
543
  /**
287
544
  * List all available tools
288
545
  */
@@ -305,11 +562,20 @@ var RainfallClient = class {
305
562
  }
306
563
  /**
307
564
  * Get tool schema/parameters
565
+ *
566
+ * @param toolId - The ID of the tool to get schema for
567
+ * @returns Tool schema including parameters and output definitions
308
568
  */
309
569
  async getToolSchema(toolId) {
310
- const subscriberId = await this.ensureSubscriberId();
311
- const response = await this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
312
- return response.params;
570
+ const schema = await fetchToolSchema(this, toolId);
571
+ return {
572
+ name: schema.name,
573
+ description: schema.description,
574
+ category: schema.category,
575
+ parameters: schema.parameters,
576
+ output: schema.output,
577
+ metadata: schema.metadata || {}
578
+ };
313
579
  }
314
580
  /**
315
581
  * Get subscriber info
@@ -394,6 +660,7 @@ var RainfallClient = class {
394
660
  };
395
661
 
396
662
  // src/namespaces/integrations.ts
663
+ init_cjs_shims();
397
664
  function createIntegrations(client) {
398
665
  return new IntegrationsNamespace(client);
399
666
  }
@@ -506,6 +773,7 @@ var IntegrationsNamespace = class {
506
773
  };
507
774
 
508
775
  // src/namespaces/memory.ts
776
+ init_cjs_shims();
509
777
  function createMemory(client) {
510
778
  return {
511
779
  create: (params) => client.executeTool("memory-create", params),
@@ -518,6 +786,7 @@ function createMemory(client) {
518
786
  }
519
787
 
520
788
  // src/namespaces/articles.ts
789
+ init_cjs_shims();
521
790
  function createArticles(client) {
522
791
  return {
523
792
  search: (params) => client.executeTool("article-search", params),
@@ -532,6 +801,7 @@ function createArticles(client) {
532
801
  }
533
802
 
534
803
  // src/namespaces/web.ts
804
+ init_cjs_shims();
535
805
  function createWeb(client) {
536
806
  return {
537
807
  search: {
@@ -545,6 +815,7 @@ function createWeb(client) {
545
815
  }
546
816
 
547
817
  // src/namespaces/ai.ts
818
+ init_cjs_shims();
548
819
  function createAI(client) {
549
820
  return {
550
821
  embeddings: {
@@ -570,6 +841,7 @@ function createAI(client) {
570
841
  }
571
842
 
572
843
  // src/namespaces/data.ts
844
+ init_cjs_shims();
573
845
  function createData(client) {
574
846
  return {
575
847
  csv: {
@@ -591,6 +863,7 @@ function createData(client) {
591
863
  }
592
864
 
593
865
  // src/namespaces/utils.ts
866
+ init_cjs_shims();
594
867
  function createUtils(client) {
595
868
  return {
596
869
  mermaid: (params) => client.executeTool("mermaid-diagram-generator", { mermaid: params.diagram }),
@@ -829,9 +1102,40 @@ var Rainfall = class {
829
1102
  }
830
1103
  /**
831
1104
  * Execute any tool by ID (low-level access)
1105
+ *
1106
+ * @param toolId - The ID of the tool to execute
1107
+ * @param params - Parameters to pass to the tool
1108
+ * @param options - Execution options including skipValidation to bypass param validation
1109
+ *
1110
+ * @example
1111
+ * ```typescript
1112
+ * // Execute with validation (default)
1113
+ * const result = await rainfall.executeTool('finviz-quotes', { tickers: ['AAPL'] });
1114
+ *
1115
+ * // Execute without validation
1116
+ * const result = await rainfall.executeTool('finviz-quotes', { tickers: ['AAPL'] }, { skipValidation: true });
1117
+ * ```
832
1118
  */
833
- async executeTool(toolId, params) {
834
- return this.client.executeTool(toolId, params);
1119
+ async executeTool(toolId, params, options) {
1120
+ return this.client.executeTool(toolId, params, options);
1121
+ }
1122
+ /**
1123
+ * Validate parameters for a tool without executing it
1124
+ *
1125
+ * @param toolId - The ID of the tool to validate params for
1126
+ * @param params - Parameters to validate
1127
+ * @returns Validation result with detailed error information
1128
+ *
1129
+ * @example
1130
+ * ```typescript
1131
+ * const result = await rainfall.validateToolParams('finviz-quotes', { tickers: ['AAPL'] });
1132
+ * if (!result.valid) {
1133
+ * console.log('Validation errors:', result.errors);
1134
+ * }
1135
+ * ```
1136
+ */
1137
+ async validateToolParams(toolId, params) {
1138
+ return this.client.validateToolParams(toolId, params);
835
1139
  }
836
1140
  /**
837
1141
  * Get current subscriber info and usage
@@ -890,7 +1194,11 @@ var Rainfall = class {
890
1194
  }
891
1195
  };
892
1196
 
1197
+ // src/types.ts
1198
+ init_cjs_shims();
1199
+
893
1200
  // src/mcp.ts
1201
+ init_errors();
894
1202
  function createRainfallMCPServer(config) {
895
1203
  const rainfall = new Rainfall(config);
896
1204
  const serverName = config.name || "rainfall-mcp-server";
package/dist/mcp.mjs CHANGED
@@ -1,8 +1,10 @@
1
+ import {
2
+ Rainfall
3
+ } from "./chunk-2FYYTIJQ.mjs";
1
4
  import {
2
5
  AuthenticationError,
3
6
  NetworkError,
4
7
  NotFoundError,
5
- Rainfall,
6
8
  RainfallError,
7
9
  RateLimitError,
8
10
  ServerError,
@@ -10,7 +12,7 @@ import {
10
12
  ToolNotFoundError,
11
13
  ValidationError,
12
14
  parseErrorResponse
13
- } from "./chunk-VDPKDC3R.mjs";
15
+ } from "./chunk-LJQEO3CY.mjs";
14
16
 
15
17
  // src/mcp.ts
16
18
  function createRainfallMCPServer(config) {
@@ -0,0 +1,12 @@
1
+ import {
2
+ formatValueForDisplay,
3
+ generateParamExample,
4
+ parseCliArgs,
5
+ parseValue
6
+ } from "./chunk-S7MOQCV4.mjs";
7
+ export {
8
+ formatValueForDisplay,
9
+ generateParamExample,
10
+ parseCliArgs,
11
+ parseValue
12
+ };