@mcpjam/sdk 0.8.1 → 0.8.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.
package/dist/index.mjs CHANGED
@@ -15,6 +15,7 @@ import { createOpenAI } from '@ai-sdk/openai';
15
15
  import { createXai } from '@ai-sdk/xai';
16
16
  import { createOpenRouter } from '@openrouter/ai-sdk-provider';
17
17
  import { createOllama } from 'ollama-ai-provider-v2';
18
+ import { PostHog } from 'posthog-node';
18
19
 
19
20
  // src/mcp-client-manager/MCPClientManager.ts
20
21
  var DEFAULT_CLIENT_VERSION = "1.0.0";
@@ -582,7 +583,8 @@ function scrubMetaAndStructuredContentFromToolResult(result) {
582
583
  }
583
584
  async function convertMCPToolsToVercelTools(listToolsResult, {
584
585
  schemas = "automatic",
585
- callTool
586
+ callTool,
587
+ needsApproval
586
588
  }) {
587
589
  const tools = {};
588
590
  for (const toolDescription of listToolsResult.tools) {
@@ -593,17 +595,17 @@ async function convertMCPToolsToVercelTools(listToolsResult, {
593
595
  const result = await callTool({ name, args, options });
594
596
  return CallToolResultSchema.parse(result);
595
597
  };
596
- const toModelOutput = isMcpAppTool(toolMeta) ? ((opts) => {
598
+ const toModelOutput = isMcpAppTool(toolMeta) ? (opts) => {
597
599
  const scrubbed = scrubMetaAndStructuredContentFromToolResult(
598
600
  opts.output
599
601
  );
600
602
  return { type: "json", value: scrubbed };
601
- }) : isChatGPTAppTool(toolMeta) ? ((opts) => {
603
+ } : isChatGPTAppTool(toolMeta) ? (opts) => {
602
604
  const scrubbed = scrubStructuredContentFromToolResult(
603
605
  opts.output
604
606
  );
605
607
  return { type: "json", value: scrubbed };
606
- }) : void 0;
608
+ } : void 0;
607
609
  let vercelTool;
608
610
  if (schemas === "automatic") {
609
611
  const normalizedInputSchema = ensureJsonSchemaObject(inputSchema);
@@ -611,7 +613,8 @@ async function convertMCPToolsToVercelTools(listToolsResult, {
611
613
  description,
612
614
  inputSchema: jsonSchema(normalizedInputSchema),
613
615
  execute,
614
- ...toModelOutput ? { toModelOutput } : {}
616
+ ...toModelOutput ? { toModelOutput } : {},
617
+ ...needsApproval != null ? { needsApproval } : {}
615
618
  });
616
619
  } else {
617
620
  const overrides = schemas;
@@ -622,7 +625,8 @@ async function convertMCPToolsToVercelTools(listToolsResult, {
622
625
  description,
623
626
  inputSchema: overrides[name].inputSchema,
624
627
  execute,
625
- ...toModelOutput ? { toModelOutput } : {}
628
+ ...toModelOutput ? { toModelOutput } : {},
629
+ ...needsApproval != null ? { needsApproval } : {}
626
630
  });
627
631
  }
628
632
  tools[name] = vercelTool;
@@ -897,6 +901,7 @@ var MCPClientManager = class {
897
901
  const listToolsResult = await this.listTools(id);
898
902
  const tools = await convertMCPToolsToVercelTools(listToolsResult, {
899
903
  schemas: options.schemas,
904
+ needsApproval: options.needsApproval,
900
905
  callTool: async ({ name, args, options: callOptions }) => {
901
906
  const requestOptions = callOptions?.abortSignal ? { signal: callOptions.abortSignal } : void 0;
902
907
  const result = await this.executeTool(
@@ -2373,6 +2378,12 @@ function calculateLatencyStats(values) {
2373
2378
  count: values.length
2374
2379
  };
2375
2380
  }
2381
+ var posthog = new PostHog(
2382
+ "phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9",
2383
+ {
2384
+ host: "https://us.i.posthog.com"
2385
+ }
2386
+ );
2376
2387
 
2377
2388
  // src/EvalTest.ts
2378
2389
  var Semaphore = class {
@@ -2427,6 +2438,13 @@ var EvalTest = class {
2427
2438
  * Run this test with the given agent and options
2428
2439
  */
2429
2440
  async run(agent, options) {
2441
+ posthog.capture({
2442
+ event: "eval_test_run_triggered",
2443
+ properties: {
2444
+ iterations: options.iterations,
2445
+ concurrency: options.concurrency ?? 5
2446
+ }
2447
+ });
2430
2448
  const concurrency = options.concurrency ?? 5;
2431
2449
  const retries = options.retries ?? 0;
2432
2450
  const timeoutMs = options.timeoutMs ?? 3e4;