@amitdeshmukh/ax-crew 8.0.1 → 8.0.3

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.
@@ -54,7 +54,13 @@ const initializeMCPServers = async (agentConfigData) => {
54
54
  const mcpClient = new AxMCPClient(transport, { debug: agentConfigData.debug || false });
55
55
  await mcpClient.init();
56
56
  initializedClients.push(mcpClient);
57
- functions.push(...mcpClient.toFunction());
57
+ // Normalize MCP tool schemas: some MCP servers omit `parameters` for
58
+ // zero-arg tools, but providers like Gemini require a valid schema.
59
+ const mcpFns = mcpClient.toFunction().map(fn => ({
60
+ ...fn,
61
+ parameters: fn.parameters ?? { type: 'object', properties: {} },
62
+ }));
63
+ functions.push(...mcpFns);
58
64
  }
59
65
  return functions;
60
66
  }
@@ -513,10 +513,14 @@ class AxCrew {
513
513
  uniqueFunctions.push(fn);
514
514
  }
515
515
  }
516
+ // Resolve factory functions (e.g., () => new Foo(state).toFunction()) into
517
+ // AxFunction objects before instrumenting, since spreading a JS function
518
+ // does not copy non-enumerable properties like `name`.
519
+ const resolvedFunctions = uniqueFunctions.map(fn => typeof fn === 'function' ? fn() : fn);
516
520
  // Wrap each function handler to record call count and latency in MetricsRegistry
517
521
  const crewId = this.crewId;
518
522
  const agentNameForMetrics = name;
519
- const instrumentedFunctions = uniqueFunctions.map(fn => ({
523
+ const instrumentedFunctions = resolvedFunctions.map(fn => ({
520
524
  ...fn,
521
525
  func: async (args, extra) => {
522
526
  const fnStart = performance.now();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@amitdeshmukh/ax-crew",
4
- "version": "8.0.1",
4
+ "version": "8.0.3",
5
5
  "description": "Build and launch a crew of AI agents with shared state. Built with axllm.dev",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -73,7 +73,13 @@ const initializeMCPServers = async (agentConfigData: AgentConfig): Promise<AxFun
73
73
  const mcpClient = new AxMCPClient(transport, {debug: agentConfigData.debug || false});
74
74
  await mcpClient.init();
75
75
  initializedClients.push(mcpClient);
76
- functions.push(...mcpClient.toFunction());
76
+ // Normalize MCP tool schemas: some MCP servers omit `parameters` for
77
+ // zero-arg tools, but providers like Gemini require a valid schema.
78
+ const mcpFns = mcpClient.toFunction().map(fn => ({
79
+ ...fn,
80
+ parameters: fn.parameters ?? { type: 'object' as const, properties: {} },
81
+ }));
82
+ functions.push(...mcpFns);
77
83
  }
78
84
 
79
85
  return functions;
@@ -651,10 +651,17 @@ class AxCrew {
651
651
  }
652
652
  }
653
653
 
654
+ // Resolve factory functions (e.g., () => new Foo(state).toFunction()) into
655
+ // AxFunction objects before instrumenting, since spreading a JS function
656
+ // does not copy non-enumerable properties like `name`.
657
+ const resolvedFunctions: AxFunction[] = uniqueFunctions.map(fn =>
658
+ typeof fn === 'function' ? (fn as () => AxFunction)() : fn
659
+ );
660
+
654
661
  // Wrap each function handler to record call count and latency in MetricsRegistry
655
662
  const crewId = this.crewId;
656
663
  const agentNameForMetrics = name;
657
- const instrumentedFunctions: AxFunction[] = uniqueFunctions.map(fn => ({
664
+ const instrumentedFunctions: AxFunction[] = resolvedFunctions.map(fn => ({
658
665
  ...fn,
659
666
  func: async (args?: any, extra?: any) => {
660
667
  const fnStart = performance.now();