@ai-sdk/openai 3.0.0-beta.54 → 3.0.0-beta.55

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
@@ -2024,6 +2024,98 @@ var webSearchPreview = createProviderDefinedToolFactoryWithOutputSchema6({
2024
2024
  outputSchema: webSearchPreviewOutputSchema
2025
2025
  });
2026
2026
 
2027
+ // src/tool/mcp.ts
2028
+ import {
2029
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema7,
2030
+ lazySchema as lazySchema14,
2031
+ zodSchema as zodSchema14
2032
+ } from "@ai-sdk/provider-utils";
2033
+ import { z as z15 } from "zod/v4";
2034
+ var jsonValueSchema = z15.lazy(
2035
+ () => z15.union([
2036
+ z15.string(),
2037
+ z15.number(),
2038
+ z15.boolean(),
2039
+ z15.null(),
2040
+ z15.array(jsonValueSchema),
2041
+ z15.record(z15.string(), jsonValueSchema)
2042
+ ])
2043
+ );
2044
+ var mcpArgsSchema = lazySchema14(
2045
+ () => zodSchema14(
2046
+ z15.object({
2047
+ serverLabel: z15.string(),
2048
+ allowedTools: z15.union([
2049
+ z15.array(z15.string()),
2050
+ z15.object({
2051
+ readOnly: z15.boolean().optional(),
2052
+ toolNames: z15.array(z15.string()).optional()
2053
+ })
2054
+ ]).optional(),
2055
+ authorization: z15.string().optional(),
2056
+ connectorId: z15.string().optional(),
2057
+ headers: z15.record(z15.string(), z15.string()).optional(),
2058
+ // TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
2059
+ // requireApproval: z
2060
+ // .union([
2061
+ // z.enum(['always', 'never']),
2062
+ // z.object({
2063
+ // readOnly: z.boolean().optional(),
2064
+ // toolNames: z.array(z.string()).optional(),
2065
+ // }),
2066
+ // ])
2067
+ // .optional(),
2068
+ serverDescription: z15.string().optional(),
2069
+ serverUrl: z15.string().optional()
2070
+ }).refine(
2071
+ (v) => v.serverUrl != null || v.connectorId != null,
2072
+ "One of serverUrl or connectorId must be provided."
2073
+ )
2074
+ )
2075
+ );
2076
+ var mcpInputSchema = lazySchema14(() => zodSchema14(z15.object({})));
2077
+ var mcpOutputSchema = lazySchema14(
2078
+ () => zodSchema14(
2079
+ z15.discriminatedUnion("type", [
2080
+ z15.object({
2081
+ type: z15.literal("call"),
2082
+ serverLabel: z15.string(),
2083
+ name: z15.string(),
2084
+ arguments: z15.string(),
2085
+ output: z15.string().nullable().optional(),
2086
+ error: z15.union([z15.string(), jsonValueSchema]).optional()
2087
+ }),
2088
+ z15.object({
2089
+ type: z15.literal("listTools"),
2090
+ serverLabel: z15.string(),
2091
+ tools: z15.array(
2092
+ z15.object({
2093
+ name: z15.string(),
2094
+ description: z15.string().optional(),
2095
+ inputSchema: jsonValueSchema,
2096
+ annotations: z15.record(z15.string(), jsonValueSchema).optional()
2097
+ })
2098
+ ),
2099
+ error: z15.union([z15.string(), jsonValueSchema]).optional()
2100
+ }),
2101
+ z15.object({
2102
+ type: z15.literal("approvalRequest"),
2103
+ serverLabel: z15.string(),
2104
+ name: z15.string(),
2105
+ arguments: z15.string(),
2106
+ approvalRequestId: z15.string()
2107
+ })
2108
+ ])
2109
+ )
2110
+ );
2111
+ var mcpToolFactory = createProviderDefinedToolFactoryWithOutputSchema7({
2112
+ id: "openai.mcp",
2113
+ name: "mcp",
2114
+ inputSchema: mcpInputSchema,
2115
+ outputSchema: mcpOutputSchema
2116
+ });
2117
+ var mcp = (args) => mcpToolFactory(args);
2118
+
2027
2119
  // src/openai-tools.ts
2028
2120
  var openaiTools = {
2029
2121
  /**
@@ -2099,7 +2191,23 @@ var openaiTools = {
2099
2191
  * @param searchContextSize - The search context size to use for the web search.
2100
2192
  * @param userLocation - The user location to use for the web search.
2101
2193
  */
2102
- webSearch
2194
+ webSearch,
2195
+ /**
2196
+ * MCP (Model Context Protocol) allows models to call tools exposed by
2197
+ * remote MCP servers or service connectors.
2198
+ *
2199
+ * Must have name `mcp`.
2200
+ *
2201
+ * @param serverLabel - Label to identify the MCP server.
2202
+ * @param allowedTools - Allowed tool names or filter object.
2203
+ * @param authorization - OAuth access token for the MCP server/connector.
2204
+ * @param connectorId - Identifier for a service connector.
2205
+ * @param headers - Optional headers to include in MCP requests.
2206
+ * // param requireApproval - Approval policy ('always'|'never'|filter object). (Removed - always 'never')
2207
+ * @param serverDescription - Optional description of the server.
2208
+ * @param serverUrl - URL for the MCP server.
2209
+ */
2210
+ mcp
2103
2211
  };
2104
2212
 
2105
2213
  // src/responses/openai-responses-language-model.ts
@@ -2125,7 +2233,7 @@ import {
2125
2233
  parseProviderOptions as parseProviderOptions4,
2126
2234
  validateTypes
2127
2235
  } from "@ai-sdk/provider-utils";
2128
- import { z as z15 } from "zod/v4";
2236
+ import { z as z16 } from "zod/v4";
2129
2237
  function isFileId(data, prefixes) {
2130
2238
  if (!prefixes) return false;
2131
2239
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2414,9 +2522,9 @@ async function convertToOpenAIResponsesInput({
2414
2522
  }
2415
2523
  return { input, warnings };
2416
2524
  }
2417
- var openaiResponsesReasoningProviderOptionsSchema = z15.object({
2418
- itemId: z15.string().nullish(),
2419
- reasoningEncryptedContent: z15.string().nullish()
2525
+ var openaiResponsesReasoningProviderOptionsSchema = z16.object({
2526
+ itemId: z16.string().nullish(),
2527
+ reasoningEncryptedContent: z16.string().nullish()
2420
2528
  });
2421
2529
 
2422
2530
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2438,285 +2546,344 @@ function mapOpenAIResponseFinishReason({
2438
2546
  }
2439
2547
 
2440
2548
  // src/responses/openai-responses-api.ts
2441
- import { lazySchema as lazySchema14, zodSchema as zodSchema14 } from "@ai-sdk/provider-utils";
2442
- import { z as z16 } from "zod/v4";
2443
- var openaiResponsesChunkSchema = lazySchema14(
2444
- () => zodSchema14(
2445
- z16.union([
2446
- z16.object({
2447
- type: z16.literal("response.output_text.delta"),
2448
- item_id: z16.string(),
2449
- delta: z16.string(),
2450
- logprobs: z16.array(
2451
- z16.object({
2452
- token: z16.string(),
2453
- logprob: z16.number(),
2454
- top_logprobs: z16.array(
2455
- z16.object({
2456
- token: z16.string(),
2457
- logprob: z16.number()
2549
+ import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
2550
+ import { z as z17 } from "zod/v4";
2551
+ var openaiResponsesChunkSchema = lazySchema15(
2552
+ () => zodSchema15(
2553
+ z17.union([
2554
+ z17.object({
2555
+ type: z17.literal("response.output_text.delta"),
2556
+ item_id: z17.string(),
2557
+ delta: z17.string(),
2558
+ logprobs: z17.array(
2559
+ z17.object({
2560
+ token: z17.string(),
2561
+ logprob: z17.number(),
2562
+ top_logprobs: z17.array(
2563
+ z17.object({
2564
+ token: z17.string(),
2565
+ logprob: z17.number()
2458
2566
  })
2459
2567
  )
2460
2568
  })
2461
2569
  ).nullish()
2462
2570
  }),
2463
- z16.object({
2464
- type: z16.enum(["response.completed", "response.incomplete"]),
2465
- response: z16.object({
2466
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
2467
- usage: z16.object({
2468
- input_tokens: z16.number(),
2469
- input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
2470
- output_tokens: z16.number(),
2471
- output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
2571
+ z17.object({
2572
+ type: z17.enum(["response.completed", "response.incomplete"]),
2573
+ response: z17.object({
2574
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
2575
+ usage: z17.object({
2576
+ input_tokens: z17.number(),
2577
+ input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
2578
+ output_tokens: z17.number(),
2579
+ output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
2472
2580
  }),
2473
- service_tier: z16.string().nullish()
2581
+ service_tier: z17.string().nullish()
2474
2582
  })
2475
2583
  }),
2476
- z16.object({
2477
- type: z16.literal("response.created"),
2478
- response: z16.object({
2479
- id: z16.string(),
2480
- created_at: z16.number(),
2481
- model: z16.string(),
2482
- service_tier: z16.string().nullish()
2584
+ z17.object({
2585
+ type: z17.literal("response.created"),
2586
+ response: z17.object({
2587
+ id: z17.string(),
2588
+ created_at: z17.number(),
2589
+ model: z17.string(),
2590
+ service_tier: z17.string().nullish()
2483
2591
  })
2484
2592
  }),
2485
- z16.object({
2486
- type: z16.literal("response.output_item.added"),
2487
- output_index: z16.number(),
2488
- item: z16.discriminatedUnion("type", [
2489
- z16.object({
2490
- type: z16.literal("message"),
2491
- id: z16.string()
2593
+ z17.object({
2594
+ type: z17.literal("response.output_item.added"),
2595
+ output_index: z17.number(),
2596
+ item: z17.discriminatedUnion("type", [
2597
+ z17.object({
2598
+ type: z17.literal("message"),
2599
+ id: z17.string()
2492
2600
  }),
2493
- z16.object({
2494
- type: z16.literal("reasoning"),
2495
- id: z16.string(),
2496
- encrypted_content: z16.string().nullish()
2601
+ z17.object({
2602
+ type: z17.literal("reasoning"),
2603
+ id: z17.string(),
2604
+ encrypted_content: z17.string().nullish()
2497
2605
  }),
2498
- z16.object({
2499
- type: z16.literal("function_call"),
2500
- id: z16.string(),
2501
- call_id: z16.string(),
2502
- name: z16.string(),
2503
- arguments: z16.string()
2606
+ z17.object({
2607
+ type: z17.literal("function_call"),
2608
+ id: z17.string(),
2609
+ call_id: z17.string(),
2610
+ name: z17.string(),
2611
+ arguments: z17.string()
2504
2612
  }),
2505
- z16.object({
2506
- type: z16.literal("web_search_call"),
2507
- id: z16.string(),
2508
- status: z16.string()
2613
+ z17.object({
2614
+ type: z17.literal("web_search_call"),
2615
+ id: z17.string(),
2616
+ status: z17.string()
2509
2617
  }),
2510
- z16.object({
2511
- type: z16.literal("computer_call"),
2512
- id: z16.string(),
2513
- status: z16.string()
2618
+ z17.object({
2619
+ type: z17.literal("computer_call"),
2620
+ id: z17.string(),
2621
+ status: z17.string()
2514
2622
  }),
2515
- z16.object({
2516
- type: z16.literal("file_search_call"),
2517
- id: z16.string()
2623
+ z17.object({
2624
+ type: z17.literal("file_search_call"),
2625
+ id: z17.string()
2518
2626
  }),
2519
- z16.object({
2520
- type: z16.literal("image_generation_call"),
2521
- id: z16.string()
2627
+ z17.object({
2628
+ type: z17.literal("image_generation_call"),
2629
+ id: z17.string()
2522
2630
  }),
2523
- z16.object({
2524
- type: z16.literal("code_interpreter_call"),
2525
- id: z16.string(),
2526
- container_id: z16.string(),
2527
- code: z16.string().nullable(),
2528
- outputs: z16.array(
2529
- z16.discriminatedUnion("type", [
2530
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2531
- z16.object({ type: z16.literal("image"), url: z16.string() })
2631
+ z17.object({
2632
+ type: z17.literal("code_interpreter_call"),
2633
+ id: z17.string(),
2634
+ container_id: z17.string(),
2635
+ code: z17.string().nullable(),
2636
+ outputs: z17.array(
2637
+ z17.discriminatedUnion("type", [
2638
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
2639
+ z17.object({ type: z17.literal("image"), url: z17.string() })
2532
2640
  ])
2533
2641
  ).nullable(),
2534
- status: z16.string()
2642
+ status: z17.string()
2643
+ }),
2644
+ z17.object({
2645
+ type: z17.literal("mcp_call"),
2646
+ id: z17.string(),
2647
+ status: z17.string()
2648
+ }),
2649
+ z17.object({
2650
+ type: z17.literal("mcp_list_tools"),
2651
+ id: z17.string()
2652
+ }),
2653
+ z17.object({
2654
+ type: z17.literal("mcp_approval_request"),
2655
+ id: z17.string()
2535
2656
  })
2536
2657
  ])
2537
2658
  }),
2538
- z16.object({
2539
- type: z16.literal("response.output_item.done"),
2540
- output_index: z16.number(),
2541
- item: z16.discriminatedUnion("type", [
2542
- z16.object({
2543
- type: z16.literal("message"),
2544
- id: z16.string()
2659
+ z17.object({
2660
+ type: z17.literal("response.output_item.done"),
2661
+ output_index: z17.number(),
2662
+ item: z17.discriminatedUnion("type", [
2663
+ z17.object({
2664
+ type: z17.literal("message"),
2665
+ id: z17.string()
2545
2666
  }),
2546
- z16.object({
2547
- type: z16.literal("reasoning"),
2548
- id: z16.string(),
2549
- encrypted_content: z16.string().nullish()
2667
+ z17.object({
2668
+ type: z17.literal("reasoning"),
2669
+ id: z17.string(),
2670
+ encrypted_content: z17.string().nullish()
2550
2671
  }),
2551
- z16.object({
2552
- type: z16.literal("function_call"),
2553
- id: z16.string(),
2554
- call_id: z16.string(),
2555
- name: z16.string(),
2556
- arguments: z16.string(),
2557
- status: z16.literal("completed")
2672
+ z17.object({
2673
+ type: z17.literal("function_call"),
2674
+ id: z17.string(),
2675
+ call_id: z17.string(),
2676
+ name: z17.string(),
2677
+ arguments: z17.string(),
2678
+ status: z17.literal("completed")
2558
2679
  }),
2559
- z16.object({
2560
- type: z16.literal("code_interpreter_call"),
2561
- id: z16.string(),
2562
- code: z16.string().nullable(),
2563
- container_id: z16.string(),
2564
- outputs: z16.array(
2565
- z16.discriminatedUnion("type", [
2566
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2567
- z16.object({ type: z16.literal("image"), url: z16.string() })
2680
+ z17.object({
2681
+ type: z17.literal("code_interpreter_call"),
2682
+ id: z17.string(),
2683
+ code: z17.string().nullable(),
2684
+ container_id: z17.string(),
2685
+ outputs: z17.array(
2686
+ z17.discriminatedUnion("type", [
2687
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
2688
+ z17.object({ type: z17.literal("image"), url: z17.string() })
2568
2689
  ])
2569
2690
  ).nullable()
2570
2691
  }),
2571
- z16.object({
2572
- type: z16.literal("image_generation_call"),
2573
- id: z16.string(),
2574
- result: z16.string()
2692
+ z17.object({
2693
+ type: z17.literal("image_generation_call"),
2694
+ id: z17.string(),
2695
+ result: z17.string()
2575
2696
  }),
2576
- z16.object({
2577
- type: z16.literal("web_search_call"),
2578
- id: z16.string(),
2579
- status: z16.string(),
2580
- action: z16.discriminatedUnion("type", [
2581
- z16.object({
2582
- type: z16.literal("search"),
2583
- query: z16.string().nullish(),
2584
- sources: z16.array(
2585
- z16.discriminatedUnion("type", [
2586
- z16.object({ type: z16.literal("url"), url: z16.string() }),
2587
- z16.object({ type: z16.literal("api"), name: z16.string() })
2697
+ z17.object({
2698
+ type: z17.literal("web_search_call"),
2699
+ id: z17.string(),
2700
+ status: z17.string(),
2701
+ action: z17.discriminatedUnion("type", [
2702
+ z17.object({
2703
+ type: z17.literal("search"),
2704
+ query: z17.string().nullish(),
2705
+ sources: z17.array(
2706
+ z17.discriminatedUnion("type", [
2707
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
2708
+ z17.object({ type: z17.literal("api"), name: z17.string() })
2588
2709
  ])
2589
2710
  ).nullish()
2590
2711
  }),
2591
- z16.object({
2592
- type: z16.literal("open_page"),
2593
- url: z16.string()
2712
+ z17.object({
2713
+ type: z17.literal("open_page"),
2714
+ url: z17.string()
2594
2715
  }),
2595
- z16.object({
2596
- type: z16.literal("find"),
2597
- url: z16.string(),
2598
- pattern: z16.string()
2716
+ z17.object({
2717
+ type: z17.literal("find"),
2718
+ url: z17.string(),
2719
+ pattern: z17.string()
2599
2720
  })
2600
2721
  ])
2601
2722
  }),
2602
- z16.object({
2603
- type: z16.literal("file_search_call"),
2604
- id: z16.string(),
2605
- queries: z16.array(z16.string()),
2606
- results: z16.array(
2607
- z16.object({
2608
- attributes: z16.record(
2609
- z16.string(),
2610
- z16.union([z16.string(), z16.number(), z16.boolean()])
2723
+ z17.object({
2724
+ type: z17.literal("file_search_call"),
2725
+ id: z17.string(),
2726
+ queries: z17.array(z17.string()),
2727
+ results: z17.array(
2728
+ z17.object({
2729
+ attributes: z17.record(
2730
+ z17.string(),
2731
+ z17.union([z17.string(), z17.number(), z17.boolean()])
2611
2732
  ),
2612
- file_id: z16.string(),
2613
- filename: z16.string(),
2614
- score: z16.number(),
2615
- text: z16.string()
2733
+ file_id: z17.string(),
2734
+ filename: z17.string(),
2735
+ score: z17.number(),
2736
+ text: z17.string()
2616
2737
  })
2617
2738
  ).nullish()
2618
2739
  }),
2619
- z16.object({
2620
- type: z16.literal("local_shell_call"),
2621
- id: z16.string(),
2622
- call_id: z16.string(),
2623
- action: z16.object({
2624
- type: z16.literal("exec"),
2625
- command: z16.array(z16.string()),
2626
- timeout_ms: z16.number().optional(),
2627
- user: z16.string().optional(),
2628
- working_directory: z16.string().optional(),
2629
- env: z16.record(z16.string(), z16.string()).optional()
2740
+ z17.object({
2741
+ type: z17.literal("local_shell_call"),
2742
+ id: z17.string(),
2743
+ call_id: z17.string(),
2744
+ action: z17.object({
2745
+ type: z17.literal("exec"),
2746
+ command: z17.array(z17.string()),
2747
+ timeout_ms: z17.number().optional(),
2748
+ user: z17.string().optional(),
2749
+ working_directory: z17.string().optional(),
2750
+ env: z17.record(z17.string(), z17.string()).optional()
2630
2751
  })
2631
2752
  }),
2632
- z16.object({
2633
- type: z16.literal("computer_call"),
2634
- id: z16.string(),
2635
- status: z16.literal("completed")
2753
+ z17.object({
2754
+ type: z17.literal("computer_call"),
2755
+ id: z17.string(),
2756
+ status: z17.literal("completed")
2757
+ }),
2758
+ z17.object({
2759
+ type: z17.literal("mcp_call"),
2760
+ id: z17.string(),
2761
+ status: z17.string(),
2762
+ arguments: z17.string(),
2763
+ name: z17.string(),
2764
+ server_label: z17.string(),
2765
+ output: z17.string().nullish(),
2766
+ error: z17.union([
2767
+ z17.string(),
2768
+ z17.object({
2769
+ type: z17.string().optional(),
2770
+ code: z17.union([z17.number(), z17.string()]).optional(),
2771
+ message: z17.string().optional()
2772
+ }).loose()
2773
+ ]).nullish()
2774
+ }),
2775
+ z17.object({
2776
+ type: z17.literal("mcp_list_tools"),
2777
+ id: z17.string(),
2778
+ server_label: z17.string(),
2779
+ tools: z17.array(
2780
+ z17.object({
2781
+ name: z17.string(),
2782
+ description: z17.string().optional(),
2783
+ input_schema: z17.any(),
2784
+ annotations: z17.record(z17.string(), z17.unknown()).optional()
2785
+ })
2786
+ ),
2787
+ error: z17.union([
2788
+ z17.string(),
2789
+ z17.object({
2790
+ type: z17.string().optional(),
2791
+ code: z17.union([z17.number(), z17.string()]).optional(),
2792
+ message: z17.string().optional()
2793
+ }).loose()
2794
+ ]).optional()
2795
+ }),
2796
+ z17.object({
2797
+ type: z17.literal("mcp_approval_request"),
2798
+ id: z17.string(),
2799
+ server_label: z17.string(),
2800
+ name: z17.string(),
2801
+ arguments: z17.string(),
2802
+ approval_request_id: z17.string()
2636
2803
  })
2637
2804
  ])
2638
2805
  }),
2639
- z16.object({
2640
- type: z16.literal("response.function_call_arguments.delta"),
2641
- item_id: z16.string(),
2642
- output_index: z16.number(),
2643
- delta: z16.string()
2806
+ z17.object({
2807
+ type: z17.literal("response.function_call_arguments.delta"),
2808
+ item_id: z17.string(),
2809
+ output_index: z17.number(),
2810
+ delta: z17.string()
2644
2811
  }),
2645
- z16.object({
2646
- type: z16.literal("response.image_generation_call.partial_image"),
2647
- item_id: z16.string(),
2648
- output_index: z16.number(),
2649
- partial_image_b64: z16.string()
2812
+ z17.object({
2813
+ type: z17.literal("response.image_generation_call.partial_image"),
2814
+ item_id: z17.string(),
2815
+ output_index: z17.number(),
2816
+ partial_image_b64: z17.string()
2650
2817
  }),
2651
- z16.object({
2652
- type: z16.literal("response.code_interpreter_call_code.delta"),
2653
- item_id: z16.string(),
2654
- output_index: z16.number(),
2655
- delta: z16.string()
2818
+ z17.object({
2819
+ type: z17.literal("response.code_interpreter_call_code.delta"),
2820
+ item_id: z17.string(),
2821
+ output_index: z17.number(),
2822
+ delta: z17.string()
2656
2823
  }),
2657
- z16.object({
2658
- type: z16.literal("response.code_interpreter_call_code.done"),
2659
- item_id: z16.string(),
2660
- output_index: z16.number(),
2661
- code: z16.string()
2824
+ z17.object({
2825
+ type: z17.literal("response.code_interpreter_call_code.done"),
2826
+ item_id: z17.string(),
2827
+ output_index: z17.number(),
2828
+ code: z17.string()
2662
2829
  }),
2663
- z16.object({
2664
- type: z16.literal("response.output_text.annotation.added"),
2665
- annotation: z16.discriminatedUnion("type", [
2666
- z16.object({
2667
- type: z16.literal("url_citation"),
2668
- url: z16.string(),
2669
- title: z16.string()
2830
+ z17.object({
2831
+ type: z17.literal("response.output_text.annotation.added"),
2832
+ annotation: z17.discriminatedUnion("type", [
2833
+ z17.object({
2834
+ type: z17.literal("url_citation"),
2835
+ url: z17.string(),
2836
+ title: z17.string()
2670
2837
  }),
2671
- z16.object({
2672
- type: z16.literal("file_citation"),
2673
- file_id: z16.string(),
2674
- filename: z16.string().nullish(),
2675
- index: z16.number().nullish(),
2676
- start_index: z16.number().nullish(),
2677
- end_index: z16.number().nullish(),
2678
- quote: z16.string().nullish()
2838
+ z17.object({
2839
+ type: z17.literal("file_citation"),
2840
+ file_id: z17.string(),
2841
+ filename: z17.string().nullish(),
2842
+ index: z17.number().nullish(),
2843
+ start_index: z17.number().nullish(),
2844
+ end_index: z17.number().nullish(),
2845
+ quote: z17.string().nullish()
2679
2846
  }),
2680
- z16.object({
2681
- type: z16.literal("container_file_citation"),
2682
- container_id: z16.string(),
2683
- file_id: z16.string(),
2684
- filename: z16.string().nullish(),
2685
- start_index: z16.number().nullish(),
2686
- end_index: z16.number().nullish(),
2687
- index: z16.number().nullish()
2847
+ z17.object({
2848
+ type: z17.literal("container_file_citation"),
2849
+ container_id: z17.string(),
2850
+ file_id: z17.string(),
2851
+ filename: z17.string().nullish(),
2852
+ start_index: z17.number().nullish(),
2853
+ end_index: z17.number().nullish(),
2854
+ index: z17.number().nullish()
2688
2855
  }),
2689
- z16.object({
2690
- type: z16.literal("file_path"),
2691
- file_id: z16.string(),
2692
- index: z16.number().nullish()
2856
+ z17.object({
2857
+ type: z17.literal("file_path"),
2858
+ file_id: z17.string(),
2859
+ index: z17.number().nullish()
2693
2860
  })
2694
2861
  ])
2695
2862
  }),
2696
- z16.object({
2697
- type: z16.literal("response.reasoning_summary_part.added"),
2698
- item_id: z16.string(),
2699
- summary_index: z16.number()
2863
+ z17.object({
2864
+ type: z17.literal("response.reasoning_summary_part.added"),
2865
+ item_id: z17.string(),
2866
+ summary_index: z17.number()
2700
2867
  }),
2701
- z16.object({
2702
- type: z16.literal("response.reasoning_summary_text.delta"),
2703
- item_id: z16.string(),
2704
- summary_index: z16.number(),
2705
- delta: z16.string()
2868
+ z17.object({
2869
+ type: z17.literal("response.reasoning_summary_text.delta"),
2870
+ item_id: z17.string(),
2871
+ summary_index: z17.number(),
2872
+ delta: z17.string()
2706
2873
  }),
2707
- z16.object({
2708
- type: z16.literal("response.reasoning_summary_part.done"),
2709
- item_id: z16.string(),
2710
- summary_index: z16.number()
2874
+ z17.object({
2875
+ type: z17.literal("response.reasoning_summary_part.done"),
2876
+ item_id: z17.string(),
2877
+ summary_index: z17.number()
2711
2878
  }),
2712
- z16.object({
2713
- type: z16.literal("error"),
2714
- code: z16.string(),
2715
- message: z16.string(),
2716
- param: z16.string().nullish(),
2717
- sequence_number: z16.number()
2879
+ z17.object({
2880
+ type: z17.literal("error"),
2881
+ code: z17.string(),
2882
+ message: z17.string(),
2883
+ param: z17.string().nullish(),
2884
+ sequence_number: z17.number()
2718
2885
  }),
2719
- z16.object({ type: z16.string() }).loose().transform((value) => ({
2886
+ z17.object({ type: z17.string() }).loose().transform((value) => ({
2720
2887
  type: "unknown_chunk",
2721
2888
  message: value.type
2722
2889
  }))
@@ -2724,188 +2891,234 @@ var openaiResponsesChunkSchema = lazySchema14(
2724
2891
  ])
2725
2892
  )
2726
2893
  );
2727
- var openaiResponsesResponseSchema = lazySchema14(
2728
- () => zodSchema14(
2729
- z16.object({
2730
- id: z16.string(),
2731
- created_at: z16.number(),
2732
- error: z16.object({
2733
- code: z16.string(),
2734
- message: z16.string()
2894
+ var openaiResponsesResponseSchema = lazySchema15(
2895
+ () => zodSchema15(
2896
+ z17.object({
2897
+ id: z17.string(),
2898
+ created_at: z17.number(),
2899
+ error: z17.object({
2900
+ code: z17.string(),
2901
+ message: z17.string()
2735
2902
  }).nullish(),
2736
- model: z16.string(),
2737
- output: z16.array(
2738
- z16.discriminatedUnion("type", [
2739
- z16.object({
2740
- type: z16.literal("message"),
2741
- role: z16.literal("assistant"),
2742
- id: z16.string(),
2743
- content: z16.array(
2744
- z16.object({
2745
- type: z16.literal("output_text"),
2746
- text: z16.string(),
2747
- logprobs: z16.array(
2748
- z16.object({
2749
- token: z16.string(),
2750
- logprob: z16.number(),
2751
- top_logprobs: z16.array(
2752
- z16.object({
2753
- token: z16.string(),
2754
- logprob: z16.number()
2903
+ model: z17.string(),
2904
+ output: z17.array(
2905
+ z17.discriminatedUnion("type", [
2906
+ z17.object({
2907
+ type: z17.literal("message"),
2908
+ role: z17.literal("assistant"),
2909
+ id: z17.string(),
2910
+ content: z17.array(
2911
+ z17.object({
2912
+ type: z17.literal("output_text"),
2913
+ text: z17.string(),
2914
+ logprobs: z17.array(
2915
+ z17.object({
2916
+ token: z17.string(),
2917
+ logprob: z17.number(),
2918
+ top_logprobs: z17.array(
2919
+ z17.object({
2920
+ token: z17.string(),
2921
+ logprob: z17.number()
2755
2922
  })
2756
2923
  )
2757
2924
  })
2758
2925
  ).nullish(),
2759
- annotations: z16.array(
2760
- z16.discriminatedUnion("type", [
2761
- z16.object({
2762
- type: z16.literal("url_citation"),
2763
- start_index: z16.number(),
2764
- end_index: z16.number(),
2765
- url: z16.string(),
2766
- title: z16.string()
2926
+ annotations: z17.array(
2927
+ z17.discriminatedUnion("type", [
2928
+ z17.object({
2929
+ type: z17.literal("url_citation"),
2930
+ start_index: z17.number(),
2931
+ end_index: z17.number(),
2932
+ url: z17.string(),
2933
+ title: z17.string()
2767
2934
  }),
2768
- z16.object({
2769
- type: z16.literal("file_citation"),
2770
- file_id: z16.string(),
2771
- filename: z16.string().nullish(),
2772
- index: z16.number().nullish(),
2773
- start_index: z16.number().nullish(),
2774
- end_index: z16.number().nullish(),
2775
- quote: z16.string().nullish()
2935
+ z17.object({
2936
+ type: z17.literal("file_citation"),
2937
+ file_id: z17.string(),
2938
+ filename: z17.string().nullish(),
2939
+ index: z17.number().nullish(),
2940
+ start_index: z17.number().nullish(),
2941
+ end_index: z17.number().nullish(),
2942
+ quote: z17.string().nullish()
2776
2943
  }),
2777
- z16.object({
2778
- type: z16.literal("container_file_citation"),
2779
- container_id: z16.string(),
2780
- file_id: z16.string(),
2781
- filename: z16.string().nullish(),
2782
- start_index: z16.number().nullish(),
2783
- end_index: z16.number().nullish(),
2784
- index: z16.number().nullish()
2944
+ z17.object({
2945
+ type: z17.literal("container_file_citation"),
2946
+ container_id: z17.string(),
2947
+ file_id: z17.string(),
2948
+ filename: z17.string().nullish(),
2949
+ start_index: z17.number().nullish(),
2950
+ end_index: z17.number().nullish(),
2951
+ index: z17.number().nullish()
2785
2952
  }),
2786
- z16.object({
2787
- type: z16.literal("file_path"),
2788
- file_id: z16.string(),
2789
- index: z16.number().nullish()
2953
+ z17.object({
2954
+ type: z17.literal("file_path"),
2955
+ file_id: z17.string(),
2956
+ index: z17.number().nullish()
2790
2957
  })
2791
2958
  ])
2792
2959
  )
2793
2960
  })
2794
2961
  )
2795
2962
  }),
2796
- z16.object({
2797
- type: z16.literal("web_search_call"),
2798
- id: z16.string(),
2799
- status: z16.string(),
2800
- action: z16.discriminatedUnion("type", [
2801
- z16.object({
2802
- type: z16.literal("search"),
2803
- query: z16.string().nullish(),
2804
- sources: z16.array(
2805
- z16.discriminatedUnion("type", [
2806
- z16.object({ type: z16.literal("url"), url: z16.string() }),
2807
- z16.object({ type: z16.literal("api"), name: z16.string() })
2963
+ z17.object({
2964
+ type: z17.literal("web_search_call"),
2965
+ id: z17.string(),
2966
+ status: z17.string(),
2967
+ action: z17.discriminatedUnion("type", [
2968
+ z17.object({
2969
+ type: z17.literal("search"),
2970
+ query: z17.string().nullish(),
2971
+ sources: z17.array(
2972
+ z17.discriminatedUnion("type", [
2973
+ z17.object({ type: z17.literal("url"), url: z17.string() }),
2974
+ z17.object({ type: z17.literal("api"), name: z17.string() })
2808
2975
  ])
2809
2976
  ).nullish()
2810
2977
  }),
2811
- z16.object({
2812
- type: z16.literal("open_page"),
2813
- url: z16.string()
2978
+ z17.object({
2979
+ type: z17.literal("open_page"),
2980
+ url: z17.string()
2814
2981
  }),
2815
- z16.object({
2816
- type: z16.literal("find"),
2817
- url: z16.string(),
2818
- pattern: z16.string()
2982
+ z17.object({
2983
+ type: z17.literal("find"),
2984
+ url: z17.string(),
2985
+ pattern: z17.string()
2819
2986
  })
2820
2987
  ])
2821
2988
  }),
2822
- z16.object({
2823
- type: z16.literal("file_search_call"),
2824
- id: z16.string(),
2825
- queries: z16.array(z16.string()),
2826
- results: z16.array(
2827
- z16.object({
2828
- attributes: z16.record(
2829
- z16.string(),
2830
- z16.union([z16.string(), z16.number(), z16.boolean()])
2989
+ z17.object({
2990
+ type: z17.literal("file_search_call"),
2991
+ id: z17.string(),
2992
+ queries: z17.array(z17.string()),
2993
+ results: z17.array(
2994
+ z17.object({
2995
+ attributes: z17.record(
2996
+ z17.string(),
2997
+ z17.union([z17.string(), z17.number(), z17.boolean()])
2831
2998
  ),
2832
- file_id: z16.string(),
2833
- filename: z16.string(),
2834
- score: z16.number(),
2835
- text: z16.string()
2999
+ file_id: z17.string(),
3000
+ filename: z17.string(),
3001
+ score: z17.number(),
3002
+ text: z17.string()
2836
3003
  })
2837
3004
  ).nullish()
2838
3005
  }),
2839
- z16.object({
2840
- type: z16.literal("code_interpreter_call"),
2841
- id: z16.string(),
2842
- code: z16.string().nullable(),
2843
- container_id: z16.string(),
2844
- outputs: z16.array(
2845
- z16.discriminatedUnion("type", [
2846
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2847
- z16.object({ type: z16.literal("image"), url: z16.string() })
3006
+ z17.object({
3007
+ type: z17.literal("code_interpreter_call"),
3008
+ id: z17.string(),
3009
+ code: z17.string().nullable(),
3010
+ container_id: z17.string(),
3011
+ outputs: z17.array(
3012
+ z17.discriminatedUnion("type", [
3013
+ z17.object({ type: z17.literal("logs"), logs: z17.string() }),
3014
+ z17.object({ type: z17.literal("image"), url: z17.string() })
2848
3015
  ])
2849
3016
  ).nullable()
2850
3017
  }),
2851
- z16.object({
2852
- type: z16.literal("image_generation_call"),
2853
- id: z16.string(),
2854
- result: z16.string()
3018
+ z17.object({
3019
+ type: z17.literal("image_generation_call"),
3020
+ id: z17.string(),
3021
+ result: z17.string()
2855
3022
  }),
2856
- z16.object({
2857
- type: z16.literal("local_shell_call"),
2858
- id: z16.string(),
2859
- call_id: z16.string(),
2860
- action: z16.object({
2861
- type: z16.literal("exec"),
2862
- command: z16.array(z16.string()),
2863
- timeout_ms: z16.number().optional(),
2864
- user: z16.string().optional(),
2865
- working_directory: z16.string().optional(),
2866
- env: z16.record(z16.string(), z16.string()).optional()
3023
+ z17.object({
3024
+ type: z17.literal("local_shell_call"),
3025
+ id: z17.string(),
3026
+ call_id: z17.string(),
3027
+ action: z17.object({
3028
+ type: z17.literal("exec"),
3029
+ command: z17.array(z17.string()),
3030
+ timeout_ms: z17.number().optional(),
3031
+ user: z17.string().optional(),
3032
+ working_directory: z17.string().optional(),
3033
+ env: z17.record(z17.string(), z17.string()).optional()
2867
3034
  })
2868
3035
  }),
2869
- z16.object({
2870
- type: z16.literal("function_call"),
2871
- call_id: z16.string(),
2872
- name: z16.string(),
2873
- arguments: z16.string(),
2874
- id: z16.string()
3036
+ z17.object({
3037
+ type: z17.literal("function_call"),
3038
+ call_id: z17.string(),
3039
+ name: z17.string(),
3040
+ arguments: z17.string(),
3041
+ id: z17.string()
2875
3042
  }),
2876
- z16.object({
2877
- type: z16.literal("computer_call"),
2878
- id: z16.string(),
2879
- status: z16.string().optional()
3043
+ z17.object({
3044
+ type: z17.literal("computer_call"),
3045
+ id: z17.string(),
3046
+ status: z17.string().optional()
2880
3047
  }),
2881
- z16.object({
2882
- type: z16.literal("reasoning"),
2883
- id: z16.string(),
2884
- encrypted_content: z16.string().nullish(),
2885
- summary: z16.array(
2886
- z16.object({
2887
- type: z16.literal("summary_text"),
2888
- text: z16.string()
3048
+ z17.object({
3049
+ type: z17.literal("reasoning"),
3050
+ id: z17.string(),
3051
+ encrypted_content: z17.string().nullish(),
3052
+ summary: z17.array(
3053
+ z17.object({
3054
+ type: z17.literal("summary_text"),
3055
+ text: z17.string()
2889
3056
  })
2890
3057
  )
3058
+ }),
3059
+ z17.object({
3060
+ type: z17.literal("mcp_call"),
3061
+ id: z17.string(),
3062
+ status: z17.string(),
3063
+ arguments: z17.string(),
3064
+ name: z17.string(),
3065
+ server_label: z17.string(),
3066
+ output: z17.string().nullish(),
3067
+ error: z17.union([
3068
+ z17.string(),
3069
+ z17.object({
3070
+ type: z17.string().optional(),
3071
+ code: z17.union([z17.number(), z17.string()]).optional(),
3072
+ message: z17.string().optional()
3073
+ }).loose()
3074
+ ]).nullish()
3075
+ }),
3076
+ z17.object({
3077
+ type: z17.literal("mcp_list_tools"),
3078
+ id: z17.string(),
3079
+ server_label: z17.string(),
3080
+ tools: z17.array(
3081
+ z17.object({
3082
+ name: z17.string(),
3083
+ description: z17.string().optional(),
3084
+ input_schema: z17.any(),
3085
+ annotations: z17.record(z17.string(), z17.unknown()).optional()
3086
+ })
3087
+ ),
3088
+ error: z17.union([
3089
+ z17.string(),
3090
+ z17.object({
3091
+ type: z17.string().optional(),
3092
+ code: z17.union([z17.number(), z17.string()]).optional(),
3093
+ message: z17.string().optional()
3094
+ }).loose()
3095
+ ]).optional()
3096
+ }),
3097
+ z17.object({
3098
+ type: z17.literal("mcp_approval_request"),
3099
+ id: z17.string(),
3100
+ server_label: z17.string(),
3101
+ name: z17.string(),
3102
+ arguments: z17.string(),
3103
+ approval_request_id: z17.string()
2891
3104
  })
2892
3105
  ])
2893
3106
  ),
2894
- service_tier: z16.string().nullish(),
2895
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
2896
- usage: z16.object({
2897
- input_tokens: z16.number(),
2898
- input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
2899
- output_tokens: z16.number(),
2900
- output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
3107
+ service_tier: z17.string().nullish(),
3108
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3109
+ usage: z17.object({
3110
+ input_tokens: z17.number(),
3111
+ input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
3112
+ output_tokens: z17.number(),
3113
+ output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
2901
3114
  })
2902
3115
  })
2903
3116
  )
2904
3117
  );
2905
3118
 
2906
3119
  // src/responses/openai-responses-options.ts
2907
- import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
2908
- import { z as z17 } from "zod/v4";
3120
+ import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
3121
+ import { z as z18 } from "zod/v4";
2909
3122
  var TOP_LOGPROBS_MAX = 20;
2910
3123
  var openaiResponsesReasoningModelIds = [
2911
3124
  "o1",
@@ -2968,18 +3181,18 @@ var openaiResponsesModelIds = [
2968
3181
  "gpt-5-chat-latest",
2969
3182
  ...openaiResponsesReasoningModelIds
2970
3183
  ];
2971
- var openaiResponsesProviderOptionsSchema = lazySchema15(
2972
- () => zodSchema15(
2973
- z17.object({
2974
- include: z17.array(
2975
- z17.enum([
3184
+ var openaiResponsesProviderOptionsSchema = lazySchema16(
3185
+ () => zodSchema16(
3186
+ z18.object({
3187
+ include: z18.array(
3188
+ z18.enum([
2976
3189
  "reasoning.encrypted_content",
2977
3190
  // handled internally by default, only needed for unknown reasoning models
2978
3191
  "file_search_call.results",
2979
3192
  "message.output_text.logprobs"
2980
3193
  ])
2981
3194
  ).nullish(),
2982
- instructions: z17.string().nullish(),
3195
+ instructions: z18.string().nullish(),
2983
3196
  /**
2984
3197
  * Return the log probabilities of the tokens.
2985
3198
  *
@@ -2992,26 +3205,26 @@ var openaiResponsesProviderOptionsSchema = lazySchema15(
2992
3205
  * @see https://platform.openai.com/docs/api-reference/responses/create
2993
3206
  * @see https://cookbook.openai.com/examples/using_logprobs
2994
3207
  */
2995
- logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3208
+ logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2996
3209
  /**
2997
3210
  * The maximum number of total calls to built-in tools that can be processed in a response.
2998
3211
  * This maximum number applies across all built-in tool calls, not per individual tool.
2999
3212
  * Any further attempts to call a tool by the model will be ignored.
3000
3213
  */
3001
- maxToolCalls: z17.number().nullish(),
3002
- metadata: z17.any().nullish(),
3003
- parallelToolCalls: z17.boolean().nullish(),
3004
- previousResponseId: z17.string().nullish(),
3005
- promptCacheKey: z17.string().nullish(),
3006
- reasoningEffort: z17.string().nullish(),
3007
- reasoningSummary: z17.string().nullish(),
3008
- safetyIdentifier: z17.string().nullish(),
3009
- serviceTier: z17.enum(["auto", "flex", "priority", "default"]).nullish(),
3010
- store: z17.boolean().nullish(),
3011
- strictJsonSchema: z17.boolean().nullish(),
3012
- textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
3013
- truncation: z17.enum(["auto", "disabled"]).nullish(),
3014
- user: z17.string().nullish()
3214
+ maxToolCalls: z18.number().nullish(),
3215
+ metadata: z18.any().nullish(),
3216
+ parallelToolCalls: z18.boolean().nullish(),
3217
+ previousResponseId: z18.string().nullish(),
3218
+ promptCacheKey: z18.string().nullish(),
3219
+ reasoningEffort: z18.string().nullish(),
3220
+ reasoningSummary: z18.string().nullish(),
3221
+ safetyIdentifier: z18.string().nullish(),
3222
+ serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
3223
+ store: z18.boolean().nullish(),
3224
+ strictJsonSchema: z18.boolean().nullish(),
3225
+ textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
3226
+ truncation: z18.enum(["auto", "disabled"]).nullish(),
3227
+ user: z18.string().nullish()
3015
3228
  })
3016
3229
  )
3017
3230
  );
@@ -3127,6 +3340,36 @@ async function prepareResponsesTools({
3127
3340
  });
3128
3341
  break;
3129
3342
  }
3343
+ case "openai.mcp": {
3344
+ const args = await validateTypes2({
3345
+ value: tool.args,
3346
+ schema: mcpArgsSchema
3347
+ });
3348
+ openaiTools2.push({
3349
+ type: "mcp",
3350
+ server_label: args.serverLabel,
3351
+ allowed_tools: Array.isArray(args.allowedTools) ? args.allowedTools : args.allowedTools ? {
3352
+ read_only: args.allowedTools.readOnly,
3353
+ tool_names: args.allowedTools.toolNames
3354
+ } : void 0,
3355
+ authorization: args.authorization,
3356
+ connector_id: args.connectorId,
3357
+ headers: args.headers,
3358
+ // require_approval:
3359
+ // typeof args.requireApproval === 'string'
3360
+ // ? args.requireApproval
3361
+ // : args.requireApproval
3362
+ // ? {
3363
+ // read_only: args.requireApproval.readOnly,
3364
+ // tool_names: args.requireApproval.toolNames,
3365
+ // }
3366
+ // : undefined,
3367
+ require_approval: "never",
3368
+ server_description: args.serverDescription,
3369
+ server_url: args.serverUrl
3370
+ });
3371
+ break;
3372
+ }
3130
3373
  }
3131
3374
  break;
3132
3375
  }
@@ -3147,7 +3390,7 @@ async function prepareResponsesTools({
3147
3390
  case "tool":
3148
3391
  return {
3149
3392
  tools: openaiTools2,
3150
- toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
3393
+ toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
3151
3394
  toolWarnings
3152
3395
  };
3153
3396
  default: {
@@ -3577,6 +3820,80 @@ var OpenAIResponsesLanguageModel = class {
3577
3820
  });
3578
3821
  break;
3579
3822
  }
3823
+ case "mcp_call": {
3824
+ content.push({
3825
+ type: "tool-call",
3826
+ toolCallId: part.id,
3827
+ toolName: "mcp",
3828
+ input: JSON.stringify({}),
3829
+ providerExecuted: true
3830
+ });
3831
+ content.push({
3832
+ type: "tool-result",
3833
+ toolCallId: part.id,
3834
+ toolName: "mcp",
3835
+ result: {
3836
+ type: "call",
3837
+ serverLabel: part.server_label,
3838
+ name: part.name,
3839
+ arguments: part.arguments,
3840
+ ...part.output != null ? { output: part.output } : {},
3841
+ ...part.error != null ? { error: part.error } : {}
3842
+ }
3843
+ });
3844
+ break;
3845
+ }
3846
+ case "mcp_list_tools": {
3847
+ content.push({
3848
+ type: "tool-call",
3849
+ toolCallId: part.id,
3850
+ toolName: "mcp",
3851
+ input: JSON.stringify({}),
3852
+ providerExecuted: true
3853
+ });
3854
+ content.push({
3855
+ type: "tool-result",
3856
+ toolCallId: part.id,
3857
+ toolName: "mcp",
3858
+ result: {
3859
+ type: "listTools",
3860
+ serverLabel: part.server_label,
3861
+ tools: part.tools.map((t) => {
3862
+ var _a2, _b2;
3863
+ return {
3864
+ name: t.name,
3865
+ description: (_a2 = t.description) != null ? _a2 : void 0,
3866
+ inputSchema: t.input_schema,
3867
+ annotations: (_b2 = t.annotations) != null ? _b2 : void 0
3868
+ };
3869
+ }),
3870
+ ...part.error != null ? { error: part.error } : {}
3871
+ }
3872
+ });
3873
+ break;
3874
+ }
3875
+ case "mcp_approval_request": {
3876
+ content.push({
3877
+ type: "tool-call",
3878
+ toolCallId: part.id,
3879
+ toolName: "mcp",
3880
+ input: JSON.stringify({}),
3881
+ providerExecuted: true
3882
+ });
3883
+ content.push({
3884
+ type: "tool-result",
3885
+ toolCallId: part.id,
3886
+ toolName: "mcp",
3887
+ result: {
3888
+ type: "approvalRequest",
3889
+ serverLabel: part.server_label,
3890
+ name: part.name,
3891
+ arguments: part.arguments,
3892
+ approvalRequestId: part.approval_request_id
3893
+ }
3894
+ });
3895
+ break;
3896
+ }
3580
3897
  case "computer_call": {
3581
3898
  content.push({
3582
3899
  type: "tool-call",
@@ -3811,6 +4128,14 @@ var OpenAIResponsesLanguageModel = class {
3811
4128
  input: "{}",
3812
4129
  providerExecuted: true
3813
4130
  });
4131
+ } else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
4132
+ controller.enqueue({
4133
+ type: "tool-call",
4134
+ toolCallId: value.item.id,
4135
+ toolName: "mcp",
4136
+ input: "{}",
4137
+ providerExecuted: true
4138
+ });
3814
4139
  } else if (value.item.type === "message") {
3815
4140
  controller.enqueue({
3816
4141
  type: "text-start",
@@ -3922,6 +4247,56 @@ var OpenAIResponsesLanguageModel = class {
3922
4247
  result: value.item.result
3923
4248
  }
3924
4249
  });
4250
+ } else if (value.item.type === "mcp_call") {
4251
+ ongoingToolCalls[value.output_index] = void 0;
4252
+ controller.enqueue({
4253
+ type: "tool-result",
4254
+ toolCallId: value.item.id,
4255
+ toolName: "mcp",
4256
+ result: {
4257
+ type: "call",
4258
+ serverLabel: value.item.server_label,
4259
+ name: value.item.name,
4260
+ arguments: value.item.arguments,
4261
+ ...value.item.output != null ? { output: value.item.output } : {},
4262
+ ...value.item.error != null ? { error: value.item.error } : {}
4263
+ }
4264
+ });
4265
+ } else if (value.item.type === "mcp_list_tools") {
4266
+ ongoingToolCalls[value.output_index] = void 0;
4267
+ controller.enqueue({
4268
+ type: "tool-result",
4269
+ toolCallId: value.item.id,
4270
+ toolName: "mcp",
4271
+ result: {
4272
+ type: "listTools",
4273
+ serverLabel: value.item.server_label,
4274
+ tools: value.item.tools.map((t) => {
4275
+ var _a2, _b2;
4276
+ return {
4277
+ name: t.name,
4278
+ description: (_a2 = t.description) != null ? _a2 : void 0,
4279
+ inputSchema: t.input_schema,
4280
+ annotations: (_b2 = t.annotations) != null ? _b2 : void 0
4281
+ };
4282
+ }),
4283
+ ...value.item.error != null ? { error: value.item.error } : {}
4284
+ }
4285
+ });
4286
+ } else if (value.item.type === "mcp_approval_request") {
4287
+ ongoingToolCalls[value.output_index] = void 0;
4288
+ controller.enqueue({
4289
+ type: "tool-result",
4290
+ toolCallId: value.item.id,
4291
+ toolName: "mcp",
4292
+ result: {
4293
+ type: "approvalRequest",
4294
+ serverLabel: value.item.server_label,
4295
+ name: value.item.name,
4296
+ arguments: value.item.arguments,
4297
+ approvalRequestId: value.item.approval_request_id
4298
+ }
4299
+ });
3925
4300
  } else if (value.item.type === "local_shell_call") {
3926
4301
  ongoingToolCalls[value.output_index] = void 0;
3927
4302
  controller.enqueue({
@@ -4261,13 +4636,13 @@ import {
4261
4636
  } from "@ai-sdk/provider-utils";
4262
4637
 
4263
4638
  // src/speech/openai-speech-options.ts
4264
- import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
4265
- import { z as z18 } from "zod/v4";
4266
- var openaiSpeechProviderOptionsSchema = lazySchema16(
4267
- () => zodSchema16(
4268
- z18.object({
4269
- instructions: z18.string().nullish(),
4270
- speed: z18.number().min(0.25).max(4).default(1).nullish()
4639
+ import { lazySchema as lazySchema17, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
4640
+ import { z as z19 } from "zod/v4";
4641
+ var openaiSpeechProviderOptionsSchema = lazySchema17(
4642
+ () => zodSchema17(
4643
+ z19.object({
4644
+ instructions: z19.string().nullish(),
4645
+ speed: z19.number().min(0.25).max(4).default(1).nullish()
4271
4646
  })
4272
4647
  )
4273
4648
  );
@@ -4384,33 +4759,33 @@ import {
4384
4759
  } from "@ai-sdk/provider-utils";
4385
4760
 
4386
4761
  // src/transcription/openai-transcription-api.ts
4387
- import { lazySchema as lazySchema17, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
4388
- import { z as z19 } from "zod/v4";
4389
- var openaiTranscriptionResponseSchema = lazySchema17(
4390
- () => zodSchema17(
4391
- z19.object({
4392
- text: z19.string(),
4393
- language: z19.string().nullish(),
4394
- duration: z19.number().nullish(),
4395
- words: z19.array(
4396
- z19.object({
4397
- word: z19.string(),
4398
- start: z19.number(),
4399
- end: z19.number()
4762
+ import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
4763
+ import { z as z20 } from "zod/v4";
4764
+ var openaiTranscriptionResponseSchema = lazySchema18(
4765
+ () => zodSchema18(
4766
+ z20.object({
4767
+ text: z20.string(),
4768
+ language: z20.string().nullish(),
4769
+ duration: z20.number().nullish(),
4770
+ words: z20.array(
4771
+ z20.object({
4772
+ word: z20.string(),
4773
+ start: z20.number(),
4774
+ end: z20.number()
4400
4775
  })
4401
4776
  ).nullish(),
4402
- segments: z19.array(
4403
- z19.object({
4404
- id: z19.number(),
4405
- seek: z19.number(),
4406
- start: z19.number(),
4407
- end: z19.number(),
4408
- text: z19.string(),
4409
- tokens: z19.array(z19.number()),
4410
- temperature: z19.number(),
4411
- avg_logprob: z19.number(),
4412
- compression_ratio: z19.number(),
4413
- no_speech_prob: z19.number()
4777
+ segments: z20.array(
4778
+ z20.object({
4779
+ id: z20.number(),
4780
+ seek: z20.number(),
4781
+ start: z20.number(),
4782
+ end: z20.number(),
4783
+ text: z20.string(),
4784
+ tokens: z20.array(z20.number()),
4785
+ temperature: z20.number(),
4786
+ avg_logprob: z20.number(),
4787
+ compression_ratio: z20.number(),
4788
+ no_speech_prob: z20.number()
4414
4789
  })
4415
4790
  ).nullish()
4416
4791
  })
@@ -4418,33 +4793,33 @@ var openaiTranscriptionResponseSchema = lazySchema17(
4418
4793
  );
4419
4794
 
4420
4795
  // src/transcription/openai-transcription-options.ts
4421
- import { lazySchema as lazySchema18, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
4422
- import { z as z20 } from "zod/v4";
4423
- var openAITranscriptionProviderOptions = lazySchema18(
4424
- () => zodSchema18(
4425
- z20.object({
4796
+ import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
4797
+ import { z as z21 } from "zod/v4";
4798
+ var openAITranscriptionProviderOptions = lazySchema19(
4799
+ () => zodSchema19(
4800
+ z21.object({
4426
4801
  /**
4427
4802
  * Additional information to include in the transcription response.
4428
4803
  */
4429
- include: z20.array(z20.string()).optional(),
4804
+ include: z21.array(z21.string()).optional(),
4430
4805
  /**
4431
4806
  * The language of the input audio in ISO-639-1 format.
4432
4807
  */
4433
- language: z20.string().optional(),
4808
+ language: z21.string().optional(),
4434
4809
  /**
4435
4810
  * An optional text to guide the model's style or continue a previous audio segment.
4436
4811
  */
4437
- prompt: z20.string().optional(),
4812
+ prompt: z21.string().optional(),
4438
4813
  /**
4439
4814
  * The sampling temperature, between 0 and 1.
4440
4815
  * @default 0
4441
4816
  */
4442
- temperature: z20.number().min(0).max(1).default(0).optional(),
4817
+ temperature: z21.number().min(0).max(1).default(0).optional(),
4443
4818
  /**
4444
4819
  * The timestamp granularities to populate for this transcription.
4445
4820
  * @default ['segment']
4446
4821
  */
4447
- timestampGranularities: z20.array(z20.enum(["word", "segment"])).default(["segment"]).optional()
4822
+ timestampGranularities: z21.array(z21.enum(["word", "segment"])).default(["segment"]).optional()
4448
4823
  })
4449
4824
  )
4450
4825
  );
@@ -4617,7 +4992,7 @@ var OpenAITranscriptionModel = class {
4617
4992
  };
4618
4993
 
4619
4994
  // src/version.ts
4620
- var VERSION = true ? "3.0.0-beta.54" : "0.0.0-test";
4995
+ var VERSION = true ? "3.0.0-beta.55" : "0.0.0-test";
4621
4996
 
4622
4997
  // src/openai-provider.ts
4623
4998
  function createOpenAI(options = {}) {