@rainfall-devkit/sdk 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -251,23 +251,28 @@ var RainfallClient = class {
251
251
  */
252
252
  async listTools() {
253
253
  const subscriberId = await this.ensureSubscriberId();
254
- const result = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-list`);
255
- if (result.keys && Array.isArray(result.keys)) {
256
- return result.keys.map((key) => ({
254
+ const result = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-descriptions`);
255
+ if (result.success && result.nodes) {
256
+ return Object.values(result.nodes);
257
+ }
258
+ const legacyResult = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-list`);
259
+ if (legacyResult.keys && Array.isArray(legacyResult.keys)) {
260
+ return legacyResult.keys.map((key) => ({
257
261
  id: key,
258
262
  name: key,
259
263
  description: "",
260
264
  category: "general"
261
265
  }));
262
266
  }
263
- return result.nodes || [];
267
+ return legacyResult.nodes || [];
264
268
  }
265
269
  /**
266
270
  * Get tool schema/parameters
267
271
  */
268
272
  async getToolSchema(toolId) {
269
273
  const subscriberId = await this.ensureSubscriberId();
270
- return this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
274
+ const response = await this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
275
+ return response.params;
271
276
  }
272
277
  /**
273
278
  * Get subscriber info
@@ -888,6 +893,30 @@ async function listTools() {
888
893
  console.log();
889
894
  }
890
895
  }
896
+ function formatSchema(obj, indent = 0) {
897
+ if (!obj || typeof obj !== "object") return String(obj);
898
+ const lines = [];
899
+ const pad = " ".repeat(indent);
900
+ for (const [key, value] of Object.entries(obj)) {
901
+ if (value && typeof value === "object") {
902
+ const prop = value;
903
+ const type = prop.type || "object";
904
+ const optional = prop.optional ? " (optional)" : "";
905
+ const desc = prop.description ? ` - ${prop.description}` : "";
906
+ lines.push(`${pad}\u2022 ${key}${optional}: ${type}${desc}`);
907
+ if (prop.properties) {
908
+ lines.push(formatSchema(prop.properties, indent + 1));
909
+ }
910
+ if (prop.items && prop.items.properties) {
911
+ lines.push(`${pad} items:`);
912
+ lines.push(formatSchema(prop.items.properties, indent + 2));
913
+ }
914
+ } else {
915
+ lines.push(`${pad}\u2022 ${key}: ${value}`);
916
+ }
917
+ }
918
+ return lines.join("\n");
919
+ }
891
920
  async function describeTool(args) {
892
921
  const toolId = args[0];
893
922
  if (!toolId) {
@@ -898,15 +927,29 @@ async function describeTool(args) {
898
927
  const rainfall = getRainfall();
899
928
  try {
900
929
  const schema = await rainfall.getToolSchema(toolId);
901
- console.log(`Tool: ${schema.name}`);
902
- console.log(`Description: ${schema.description}`);
903
- console.log(`Category: ${schema.category}`);
904
930
  console.log(`
905
- Parameters:`);
906
- console.log(JSON.stringify(schema.parameters, null, 2));
931
+ ${schema.name}`);
932
+ console.log(` ${"\u2500".repeat(Math.max(schema.name.length, 40))}`);
933
+ console.log(`
934
+ Description:`);
935
+ console.log(` ${schema.description.split("\n").join("\n ")}`);
907
936
  console.log(`
908
- Output:`);
909
- console.log(JSON.stringify(schema.output, null, 2));
937
+ Category: ${schema.category}`);
938
+ console.log(`
939
+ Parameters:`);
940
+ if (schema.parameters && typeof schema.parameters === "object" && Object.keys(schema.parameters).length > 0) {
941
+ console.log(formatSchema(schema.parameters, 2));
942
+ } else {
943
+ console.log(" None");
944
+ }
945
+ console.log(`
946
+ Output:`);
947
+ if (schema.output && typeof schema.output === "object" && Object.keys(schema.output).length > 0) {
948
+ console.log(formatSchema(schema.output, 2));
949
+ } else {
950
+ console.log(" None");
951
+ }
952
+ console.log();
910
953
  } catch (error) {
911
954
  console.error(`Error: Tool '${toolId}' not found`);
912
955
  process.exit(1);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Rainfall
4
- } from "../chunk-OT6N7K6Q.mjs";
4
+ } from "../chunk-PNYIIMJS.mjs";
5
5
 
6
6
  // src/cli/index.ts
7
7
  import { readFileSync, existsSync, writeFileSync, mkdirSync } from "fs";
@@ -137,6 +137,30 @@ async function listTools() {
137
137
  console.log();
138
138
  }
139
139
  }
140
+ function formatSchema(obj, indent = 0) {
141
+ if (!obj || typeof obj !== "object") return String(obj);
142
+ const lines = [];
143
+ const pad = " ".repeat(indent);
144
+ for (const [key, value] of Object.entries(obj)) {
145
+ if (value && typeof value === "object") {
146
+ const prop = value;
147
+ const type = prop.type || "object";
148
+ const optional = prop.optional ? " (optional)" : "";
149
+ const desc = prop.description ? ` - ${prop.description}` : "";
150
+ lines.push(`${pad}\u2022 ${key}${optional}: ${type}${desc}`);
151
+ if (prop.properties) {
152
+ lines.push(formatSchema(prop.properties, indent + 1));
153
+ }
154
+ if (prop.items && prop.items.properties) {
155
+ lines.push(`${pad} items:`);
156
+ lines.push(formatSchema(prop.items.properties, indent + 2));
157
+ }
158
+ } else {
159
+ lines.push(`${pad}\u2022 ${key}: ${value}`);
160
+ }
161
+ }
162
+ return lines.join("\n");
163
+ }
140
164
  async function describeTool(args) {
141
165
  const toolId = args[0];
142
166
  if (!toolId) {
@@ -147,15 +171,29 @@ async function describeTool(args) {
147
171
  const rainfall = getRainfall();
148
172
  try {
149
173
  const schema = await rainfall.getToolSchema(toolId);
150
- console.log(`Tool: ${schema.name}`);
151
- console.log(`Description: ${schema.description}`);
152
- console.log(`Category: ${schema.category}`);
153
174
  console.log(`
154
- Parameters:`);
155
- console.log(JSON.stringify(schema.parameters, null, 2));
175
+ ${schema.name}`);
176
+ console.log(` ${"\u2500".repeat(Math.max(schema.name.length, 40))}`);
177
+ console.log(`
178
+ Description:`);
179
+ console.log(` ${schema.description.split("\n").join("\n ")}`);
156
180
  console.log(`
157
- Output:`);
158
- console.log(JSON.stringify(schema.output, null, 2));
181
+ Category: ${schema.category}`);
182
+ console.log(`
183
+ Parameters:`);
184
+ if (schema.parameters && typeof schema.parameters === "object" && Object.keys(schema.parameters).length > 0) {
185
+ console.log(formatSchema(schema.parameters, 2));
186
+ } else {
187
+ console.log(" None");
188
+ }
189
+ console.log(`
190
+ Output:`);
191
+ if (schema.output && typeof schema.output === "object" && Object.keys(schema.output).length > 0) {
192
+ console.log(formatSchema(schema.output, 2));
193
+ } else {
194
+ console.log(" None");
195
+ }
196
+ console.log();
159
197
  } catch (error) {
160
198
  console.error(`Error: Tool '${toolId}' not found`);
161
199
  process.exit(1);
package/dist/index.js CHANGED
@@ -287,23 +287,28 @@ var RainfallClient = class {
287
287
  */
288
288
  async listTools() {
289
289
  const subscriberId = await this.ensureSubscriberId();
290
- const result = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-list`);
291
- if (result.keys && Array.isArray(result.keys)) {
292
- return result.keys.map((key) => ({
290
+ const result = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-descriptions`);
291
+ if (result.success && result.nodes) {
292
+ return Object.values(result.nodes);
293
+ }
294
+ const legacyResult = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-list`);
295
+ if (legacyResult.keys && Array.isArray(legacyResult.keys)) {
296
+ return legacyResult.keys.map((key) => ({
293
297
  id: key,
294
298
  name: key,
295
299
  description: "",
296
300
  category: "general"
297
301
  }));
298
302
  }
299
- return result.nodes || [];
303
+ return legacyResult.nodes || [];
300
304
  }
301
305
  /**
302
306
  * Get tool schema/parameters
303
307
  */
304
308
  async getToolSchema(toolId) {
305
309
  const subscriberId = await this.ensureSubscriberId();
306
- return this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
310
+ const response = await this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
311
+ return response.params;
307
312
  }
308
313
  /**
309
314
  * Get subscriber info
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  TimeoutError,
11
11
  ToolNotFoundError,
12
12
  ValidationError
13
- } from "./chunk-OT6N7K6Q.mjs";
13
+ } from "./chunk-PNYIIMJS.mjs";
14
14
 
15
15
  // src/index.ts
16
16
  var VERSION = "0.1.0";
package/dist/mcp.js CHANGED
@@ -287,23 +287,28 @@ var RainfallClient = class {
287
287
  */
288
288
  async listTools() {
289
289
  const subscriberId = await this.ensureSubscriberId();
290
- const result = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-list`);
291
- if (result.keys && Array.isArray(result.keys)) {
292
- return result.keys.map((key) => ({
290
+ const result = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-descriptions`);
291
+ if (result.success && result.nodes) {
292
+ return Object.values(result.nodes);
293
+ }
294
+ const legacyResult = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-list`);
295
+ if (legacyResult.keys && Array.isArray(legacyResult.keys)) {
296
+ return legacyResult.keys.map((key) => ({
293
297
  id: key,
294
298
  name: key,
295
299
  description: "",
296
300
  category: "general"
297
301
  }));
298
302
  }
299
- return result.nodes || [];
303
+ return legacyResult.nodes || [];
300
304
  }
301
305
  /**
302
306
  * Get tool schema/parameters
303
307
  */
304
308
  async getToolSchema(toolId) {
305
309
  const subscriberId = await this.ensureSubscriberId();
306
- return this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
310
+ const response = await this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
311
+ return response.params;
307
312
  }
308
313
  /**
309
314
  * Get subscriber info
package/dist/mcp.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  ToolNotFoundError,
11
11
  ValidationError,
12
12
  parseErrorResponse
13
- } from "./chunk-OT6N7K6Q.mjs";
13
+ } from "./chunk-PNYIIMJS.mjs";
14
14
 
15
15
  // src/mcp.ts
16
16
  function createRainfallMCPServer(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainfall-devkit/sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Official SDK for Rainfall API - 200+ tools for building AI-powered applications",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -65,5 +65,8 @@
65
65
  },
66
66
  "engines": {
67
67
  "node": ">=18"
68
+ },
69
+ "dependencies": {
70
+ "@rainfall-devkit/sdk": "^0.1.5"
68
71
  }
69
72
  }