@toolplex/client 0.1.7 → 0.1.9

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.
@@ -56,7 +56,6 @@ export async function handleCallTool(params) {
56
56
  latency_ms: Date.now() - startTime,
57
57
  });
58
58
  return {
59
- role: "system",
60
59
  content: content,
61
60
  };
62
61
  }
@@ -75,7 +74,7 @@ export async function handleCallTool(params) {
75
74
  latency_ms: Date.now() - startTime,
76
75
  });
77
76
  return {
78
- role: "system",
77
+ isError: true,
79
78
  content: [
80
79
  {
81
80
  type: "text",
@@ -34,7 +34,6 @@ export async function handleGetServerConfig(params) {
34
34
  latency_ms: Date.now() - startTime,
35
35
  });
36
36
  return {
37
- role: "system",
38
37
  content: [
39
38
  {
40
39
  type: "text",
@@ -61,7 +60,7 @@ export async function handleGetServerConfig(params) {
61
60
  latency_ms: Date.now() - startTime,
62
61
  });
63
62
  return {
64
- role: "system",
63
+ isError: true,
65
64
  content: [
66
65
  {
67
66
  type: "text",
@@ -51,7 +51,6 @@ export async function handleInitialize(params) {
51
51
  await logger.debug("Building initialization response");
52
52
  // Safe to use prompts after init.
53
53
  const result = {
54
- role: "system",
55
54
  content: [
56
55
  {
57
56
  type: "text",
@@ -2,7 +2,71 @@ import { FileLogger } from "../../shared/fileLogger.js";
2
2
  import { ServerInstallResultSchema, ListToolsResultSchema, } from "../../shared/serverManagerTypes.js";
3
3
  import Registry from "../registry.js";
4
4
  import { RuntimeCheck } from "../utils/runtimeCheck.js";
5
+ import { isAbsolute, parse } from "path";
5
6
  const logger = FileLogger;
7
+ /**
8
+ * Sanitizes ServerConfig for telemetry logging by extracting aggregate patterns
9
+ * while avoiding PII exposure. This function extracts useful installation patterns
10
+ * without logging sensitive data like file paths, API keys, or user-specific values.
11
+ *
12
+ * SECURITY: This function only logs metadata patterns, never actual values:
13
+ * - Command names (not paths): "npx" vs "/Users/john/bin/tool"
14
+ * - Argument flags (not values): "--port" vs actual port numbers
15
+ * - Environment variable names (not values): "API_KEY" vs actual keys
16
+ * - Path types for portability analysis: "absolute" vs "package_manager"
17
+ */
18
+ function sanitizeServerConfig(config) {
19
+ // Extract command executable name without sensitive path information
20
+ const extractCommandType = (command) => {
21
+ if (!command)
22
+ return "none";
23
+ // For absolute paths, extract only the executable name (e.g., "/usr/bin/node" -> "node")
24
+ if (isAbsolute(command)) {
25
+ return parse(command).name;
26
+ }
27
+ // For relative commands, get the base command (e.g., "npx" from "npx --version")
28
+ return (command
29
+ .split(/[\s/\\]/)
30
+ .pop()
31
+ ?.split(".")[0] || "unknown");
32
+ };
33
+ // Categorize path types for portability analysis - helps identify installation reliability patterns
34
+ const detectPathType = (command, args) => {
35
+ if (!command)
36
+ return "system_command";
37
+ // Absolute paths indicate potential portability issues
38
+ if (isAbsolute(command) || args?.some((arg) => isAbsolute(arg))) {
39
+ return "absolute";
40
+ }
41
+ // Package managers are typically more reliable across systems
42
+ if (["npx", "uvx", "pip", "yarn", "pnpm"].includes(command)) {
43
+ return "package_manager";
44
+ }
45
+ return "system_command";
46
+ };
47
+ // Extract common argument flags and patterns (not values) for usage analysis
48
+ const extractArgPatterns = (args) => {
49
+ return (args?.filter((arg) => arg.startsWith("-") || // Command flags like --port, --config
50
+ ["stdio", "mcp", "start", "latest", "@latest"].includes(arg)) || []);
51
+ };
52
+ // Extract environment variable names (not values) to understand integration patterns
53
+ // SAFE: Only logs key names like "API_KEY", "DATABASE_URL" - never the actual values
54
+ const extractEnvKeys = (env) => {
55
+ if (!env)
56
+ return [];
57
+ return Object.keys(env).sort();
58
+ };
59
+ return {
60
+ runtime: config.runtime || "node",
61
+ transport: config.transport,
62
+ command_type: extractCommandType(config.command),
63
+ path_type: detectPathType(config.command, config.args),
64
+ arg_patterns: extractArgPatterns(config.args),
65
+ arg_count: config.args?.length || 0,
66
+ env_keys: extractEnvKeys(config.env),
67
+ env_count: config.env ? Object.keys(config.env).length : 0,
68
+ };
69
+ }
6
70
  async function installServer(serverId, serverName, description, serverManagerClient, serverConfig) {
7
71
  await logger.info(`Starting installation of tool ${serverId}: ${serverName}`);
8
72
  await logger.debug(`Server config: ${JSON.stringify(serverConfig)}, Server ID: ${serverId}`);
@@ -91,6 +155,7 @@ export async function handleInstallServer(params) {
91
155
  success: true,
92
156
  log_context: {
93
157
  server_id: installResult.server_id,
158
+ sanitized_config: sanitizeServerConfig(config),
94
159
  },
95
160
  latency_ms: Date.now() - startTime,
96
161
  });
@@ -111,7 +176,6 @@ export async function handleInstallServer(params) {
111
176
  });
112
177
  }
113
178
  return {
114
- role: "system",
115
179
  content,
116
180
  };
117
181
  }
@@ -144,7 +208,7 @@ export async function handleInstallServer(params) {
144
208
  });
145
209
  }
146
210
  return {
147
- role: "system",
211
+ isError: true,
148
212
  content,
149
213
  };
150
214
  }
@@ -46,7 +46,6 @@ export async function handleListServers() {
46
46
  // Build response content
47
47
  if (allServers.length === 0) {
48
48
  return {
49
- role: "system",
50
49
  content: [
51
50
  {
52
51
  type: "text",
@@ -56,7 +55,6 @@ export async function handleListServers() {
56
55
  };
57
56
  }
58
57
  return {
59
- role: "system",
60
58
  content: [
61
59
  {
62
60
  type: "text",
@@ -83,7 +81,7 @@ export async function handleListServers() {
83
81
  latency_ms: Date.now() - startTime,
84
82
  });
85
83
  return {
86
- role: "system",
84
+ isError: true,
87
85
  content: [
88
86
  {
89
87
  type: "text",
@@ -110,7 +110,6 @@ export async function handleListTools(params) {
110
110
  latency_ms: Date.now() - startTime,
111
111
  });
112
112
  return {
113
- role: "system",
114
113
  content,
115
114
  };
116
115
  }
@@ -128,7 +127,7 @@ export async function handleListTools(params) {
128
127
  latency_ms: Date.now() - startTime,
129
128
  });
130
129
  return {
131
- role: "system",
130
+ isError: true,
132
131
  content: [
133
132
  {
134
133
  type: "text",
@@ -29,7 +29,6 @@ export async function handleLogPlaybookUsage(params) {
29
29
  latency_ms: Date.now() - startTime,
30
30
  });
31
31
  return {
32
- role: "system",
33
32
  content: [
34
33
  {
35
34
  type: "text",
@@ -51,7 +50,7 @@ export async function handleLogPlaybookUsage(params) {
51
50
  latency_ms: Date.now() - startTime,
52
51
  });
53
52
  return {
54
- role: "system",
53
+ isError: true,
55
54
  content: [
56
55
  {
57
56
  type: "text",
@@ -46,7 +46,7 @@ export async function handleLookupEntityTool(params) {
46
46
  latency_ms: Date.now() - startTime,
47
47
  });
48
48
  return {
49
- role: "system",
49
+ isError: true,
50
50
  content: [
51
51
  {
52
52
  type: "text",
@@ -92,7 +92,6 @@ export async function handleLookupEntityTool(params) {
92
92
  });
93
93
  }
94
94
  return {
95
- role: "system",
96
95
  content,
97
96
  };
98
97
  }
@@ -109,7 +108,7 @@ export async function handleLookupEntityTool(params) {
109
108
  latency_ms: Date.now() - startTime,
110
109
  });
111
110
  return {
112
- role: "system",
111
+ isError: true,
113
112
  content: [
114
113
  {
115
114
  type: "text",
@@ -33,7 +33,6 @@ export async function handleSavePlaybook(params) {
33
33
  latency_ms: Date.now() - startTime,
34
34
  });
35
35
  return {
36
- role: "system",
37
36
  content: [
38
37
  {
39
38
  type: "text",
@@ -53,7 +52,7 @@ export async function handleSavePlaybook(params) {
53
52
  latency_ms: Date.now() - startTime,
54
53
  });
55
54
  return {
56
- role: "system",
55
+ isError: true,
57
56
  content: [
58
57
  {
59
58
  type: "text",
@@ -55,7 +55,6 @@ export async function handleSearchTool(params) {
55
55
  if (totalResults === 0) {
56
56
  await logger.info("No search results found");
57
57
  return {
58
- role: "system",
59
58
  content: [
60
59
  {
61
60
  type: "text",
@@ -91,7 +90,6 @@ export async function handleSearchTool(params) {
91
90
  ];
92
91
  await logger.info("Search completed successfully");
93
92
  return {
94
- role: "system",
95
93
  content,
96
94
  };
97
95
  }
@@ -110,7 +108,7 @@ export async function handleSearchTool(params) {
110
108
  latency_ms: Date.now() - startTime,
111
109
  });
112
110
  return {
113
- role: "system",
111
+ isError: true,
114
112
  content: [
115
113
  {
116
114
  type: "text",
@@ -34,7 +34,6 @@ export async function handleSubmitFeedback(params) {
34
34
  latency_ms: Date.now() - startTime,
35
35
  });
36
36
  return {
37
- role: "system",
38
37
  content: [
39
38
  {
40
39
  type: "text",
@@ -58,7 +57,7 @@ export async function handleSubmitFeedback(params) {
58
57
  latency_ms: Date.now() - startTime,
59
58
  });
60
59
  return {
61
- role: "system",
60
+ isError: true,
62
61
  content: [
63
62
  {
64
63
  type: "text",
@@ -41,7 +41,6 @@ export async function handleUninstallServer(params) {
41
41
  latency_ms: Date.now() - startTime,
42
42
  });
43
43
  return {
44
- role: "system",
45
44
  content: [
46
45
  {
47
46
  type: "text",
@@ -67,7 +66,7 @@ export async function handleUninstallServer(params) {
67
66
  latency_ms: Date.now() - startTime,
68
67
  });
69
68
  return {
70
- role: "system",
69
+ isError: true,
71
70
  content: [
72
71
  {
73
72
  type: "text",
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.1.7";
1
+ export declare const version = "0.1.9";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.1.7';
1
+ export const version = '0.1.9';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolplex/client",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "author": "ToolPlex LLC",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "description": "The official ToolPlex client for AI agent tool discovery and execution",