@probelabs/probe 0.6.0-rc207 → 0.6.0-rc208

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.
@@ -127,6 +127,7 @@ export function parseXmlMcpToolCall(xmlString, mcpToolNames = []) {
127
127
  export class MCPXmlBridge {
128
128
  constructor(options = {}) {
129
129
  this.debug = options.debug || false;
130
+ this.tracer = options.tracer || null;
130
131
  this.mcpTools = {};
131
132
  this.mcpManager = null;
132
133
  this.xmlDefinitions = {};
@@ -179,8 +180,8 @@ export class MCPXmlBridge {
179
180
  console.error('[MCP DEBUG] Initializing MCP client manager...');
180
181
  }
181
182
 
182
- // Initialize the MCP client manager
183
- this.mcpManager = new MCPClientManager({ debug: this.debug });
183
+ // Initialize the MCP client manager with tracer support
184
+ this.mcpManager = new MCPClientManager({ debug: this.debug, tracer: this.tracer });
184
185
  const result = await this.mcpManager.initialize(mcpConfigs);
185
186
 
186
187
  // Get tools from the manager
@@ -211,11 +212,20 @@ export class MCPXmlBridge {
211
212
  }
212
213
 
213
214
  /**
214
- * Get all XML tool definitions for inclusion in system prompt
215
+ * Get XML tool definitions for inclusion in system prompt
216
+ * @param {Array<string>|null} filterToolNames - Optional list of tool names to include (if null, include all)
215
217
  * @returns {string} Combined XML tool definitions
216
218
  */
217
- getXmlToolDefinitions() {
218
- return Object.values(this.xmlDefinitions).join('\n\n');
219
+ getXmlToolDefinitions(filterToolNames = null) {
220
+ if (filterToolNames === null) {
221
+ return Object.values(this.xmlDefinitions).join('\n\n');
222
+ }
223
+
224
+ // Filter definitions based on provided tool names
225
+ return Object.entries(this.xmlDefinitions)
226
+ .filter(([name]) => filterToolNames.includes(name))
227
+ .map(([, def]) => def)
228
+ .join('\n\n');
219
229
  }
220
230
 
221
231
  /**
@@ -231,6 +231,32 @@ export class SimpleAppTracer {
231
231
  });
232
232
  }
233
233
 
234
+ /**
235
+ * Record MCP (Model Context Protocol) events
236
+ * Tracks server connections, tool discovery, method filtering, and tool execution
237
+ */
238
+ recordMcpEvent(eventType, data = {}) {
239
+ if (!this.isEnabled()) return;
240
+
241
+ this.addEvent(`mcp.${eventType}`, {
242
+ 'session.id': this.sessionId,
243
+ ...data
244
+ });
245
+ }
246
+
247
+ /**
248
+ * Record bash tool events
249
+ * Tracks command permission checks, allowed/denied commands, and execution
250
+ */
251
+ recordBashEvent(eventType, data = {}) {
252
+ if (!this.isEnabled()) return;
253
+
254
+ this.addEvent(`bash.${eventType}`, {
255
+ 'session.id': this.sessionId,
256
+ ...data
257
+ });
258
+ }
259
+
234
260
  setAttributes(attributes) {
235
261
  // For simplicity, just log attributes when no active span
236
262
  if (this.telemetry && this.telemetry.enableConsole) {
package/src/tools/bash.js CHANGED
@@ -31,16 +31,18 @@ export const bashTool = (options = {}) => {
31
31
  bashConfig = {},
32
32
  debug = false,
33
33
  cwd,
34
- allowedFolders = []
34
+ allowedFolders = [],
35
+ tracer = null
35
36
  } = options;
36
37
 
37
- // Create permission checker
38
+ // Create permission checker with tracer for telemetry
38
39
  const permissionChecker = new BashPermissionChecker({
39
40
  allow: bashConfig.allow,
40
41
  deny: bashConfig.deny,
41
42
  disableDefaultAllow: bashConfig.disableDefaultAllow,
42
43
  disableDefaultDeny: bashConfig.disableDefaultDeny,
43
- debug
44
+ debug,
45
+ tracer
44
46
  });
45
47
 
46
48
  // Determine default working directory