1use super::wire::present_nullable;
6use super::{RealtimeFunctionTool, RealtimeMcphttpError};
7use crate::Rest;
8use serde::{Deserialize, Serialize};
9
10pub type RealtimeToolsConfig = Vec<RealtimeToolsConfigUnion>;
12
13#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
15#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
16#[serde(untagged)]
17#[allow(clippy::large_enum_variant)]
18#[derive(gproxy_protocol_macros::DeclaredFields)]
19#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
20pub enum RealtimeToolsConfigUnion {
21 RealtimeFunctionTool(RealtimeFunctionTool),
22 RealtimeToolsConfigUnionMcp(RealtimeToolsConfigUnionMcp),
23}
24
25#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
27#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
28#[derive(gproxy_protocol_macros::DeclaredFields)]
29#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
30pub struct RealtimeMcpApprovalResponse {
31 pub id: String,
32 pub approval_request_id: String,
33 pub approve: bool,
34 #[serde(rename = "type")]
35 pub type_: RealtimeMcpApprovalResponseType,
36 #[serde(
37 default,
38 deserialize_with = "present_nullable",
39 skip_serializing_if = "Option::is_none"
40 )]
41 pub reason: Option<Option<String>>,
42 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
43 pub rest: Rest,
44}
45
46#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
48#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
49#[derive(gproxy_protocol_macros::DeclaredFields)]
50#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
51pub struct RealtimeMcpListTools {
52 pub server_label: String,
53 pub tools: Vec<RealtimeMcpListToolsTool>,
54 #[serde(rename = "type")]
55 pub type_: RealtimeMcpListToolsType,
56 #[serde(
57 default,
58 deserialize_with = "present_nullable",
59 skip_serializing_if = "Option::is_none"
60 )]
61 pub id: Option<Option<String>>,
62 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
63 pub rest: Rest,
64}
65
66#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
68#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
69#[derive(gproxy_protocol_macros::DeclaredFields)]
70#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
71pub struct RealtimeMcpToolCall {
72 pub id: String,
73 pub arguments: String,
74 pub name: String,
75 pub server_label: String,
76 #[serde(rename = "type")]
77 pub type_: RealtimeMcpToolCallType,
78 #[serde(
79 default,
80 deserialize_with = "present_nullable",
81 skip_serializing_if = "Option::is_none"
82 )]
83 pub approval_request_id: Option<Option<String>>,
84 #[serde(
85 default,
86 deserialize_with = "present_nullable",
87 skip_serializing_if = "Option::is_none"
88 )]
89 pub error: Option<Option<RealtimeMcpToolCallError>>,
90 #[serde(
91 default,
92 deserialize_with = "present_nullable",
93 skip_serializing_if = "Option::is_none"
94 )]
95 pub output: Option<Option<String>>,
96 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
97 pub rest: Rest,
98}
99
100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
102#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
103#[derive(gproxy_protocol_macros::DeclaredFields)]
104#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
105pub struct RealtimeMcpApprovalRequest {
106 pub id: String,
107 pub arguments: String,
108 pub name: String,
109 pub server_label: String,
110 #[serde(rename = "type")]
111 pub type_: RealtimeMcpApprovalRequestType,
112 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
113 pub rest: Rest,
114}
115
116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
118#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
119#[derive(gproxy_protocol_macros::DeclaredFields)]
120#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
121pub struct RealtimeToolsConfigUnionMcp {
122 pub server_label: String,
123 #[serde(rename = "type")]
124 pub type_: RealtimeToolsConfigUnionMcpType,
125 #[serde(
126 default,
127 deserialize_with = "present_nullable",
128 skip_serializing_if = "Option::is_none"
129 )]
130 pub allowed_callers: Option<Option<Vec<RealtimeToolsConfigUnionMcpAllowedCallersItem>>>,
131 #[serde(
132 default,
133 deserialize_with = "present_nullable",
134 skip_serializing_if = "Option::is_none"
135 )]
136 pub allowed_tools: Option<Option<RealtimeToolsConfigUnionMcpAllowedTools>>,
137 #[serde(
138 default,
139 deserialize_with = "present_nullable",
140 skip_serializing_if = "Option::is_none"
141 )]
142 pub authorization: Option<Option<String>>,
143 #[serde(
144 default,
145 deserialize_with = "present_nullable",
146 skip_serializing_if = "Option::is_none"
147 )]
148 pub connector_id: Option<Option<RealtimeToolsConfigUnionMcpConnectorId>>,
149 #[serde(
150 default,
151 deserialize_with = "present_nullable",
152 skip_serializing_if = "Option::is_none"
153 )]
154 pub defer_loading: Option<Option<bool>>,
155 #[serde(
156 default,
157 deserialize_with = "present_nullable",
158 skip_serializing_if = "Option::is_none"
159 )]
160 pub headers: Option<Option<std::collections::BTreeMap<String, String>>>,
161 #[serde(
162 default,
163 deserialize_with = "present_nullable",
164 skip_serializing_if = "Option::is_none"
165 )]
166 pub require_approval: Option<Option<RealtimeToolsConfigUnionMcpRequireApproval>>,
167 #[serde(
168 default,
169 deserialize_with = "present_nullable",
170 skip_serializing_if = "Option::is_none"
171 )]
172 pub server_description: Option<Option<String>>,
173 #[serde(
174 default,
175 deserialize_with = "present_nullable",
176 skip_serializing_if = "Option::is_none"
177 )]
178 pub server_url: Option<Option<String>>,
179 #[serde(
180 default,
181 deserialize_with = "present_nullable",
182 skip_serializing_if = "Option::is_none"
183 )]
184 pub tunnel_id: Option<Option<String>>,
185 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
186 pub rest: Rest,
187}
188
189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
191#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
192#[derive(gproxy_protocol_macros::DeclaredFields)]
193#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
194pub struct RealtimeMcpListToolsTool {
195 pub input_schema: serde_json::Value,
196 pub name: String,
197 #[serde(
198 default,
199 deserialize_with = "present_nullable",
200 skip_serializing_if = "Option::is_none"
201 )]
202 pub annotations: Option<Option<serde_json::Value>>,
203 #[serde(
204 default,
205 deserialize_with = "present_nullable",
206 skip_serializing_if = "Option::is_none"
207 )]
208 pub description: Option<Option<String>>,
209 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
210 pub rest: Rest,
211}
212
213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
215#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
216#[serde(untagged)]
217#[derive(gproxy_protocol_macros::DeclaredFields)]
218#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
219pub enum RealtimeMcpToolCallError {
220 RealtimeMcpProtocolError(RealtimeMcpProtocolError),
221 RealtimeMcpToolExecutionError(RealtimeMcpToolExecutionError),
222 RealtimeMcphttpError(RealtimeMcphttpError),
223 Variant4(()),
224}
225
226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
228#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
229#[serde(untagged)]
230#[derive(gproxy_protocol_macros::DeclaredFields)]
231#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
232pub enum RealtimeToolsConfigUnionMcpAllowedTools {
233 Items(Vec<String>),
234 RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilter(
235 RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilter,
236 ),
237 Variant3(()),
238}
239
240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
242#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
243#[serde(untagged)]
244#[derive(gproxy_protocol_macros::DeclaredFields)]
245#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
246pub enum RealtimeToolsConfigUnionMcpRequireApproval {
247 RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilter(
248 RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilter,
249 ),
250 Literal(RealtimeToolsConfigUnionMcpRequireApprovalVariant2),
251 Variant3(()),
252}
253
254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
256#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
257#[derive(gproxy_protocol_macros::DeclaredFields)]
258#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
259pub struct RealtimeMcpProtocolError {
260 pub code: i64,
261 pub message: String,
262 #[serde(rename = "type")]
263 pub type_: RealtimeMcpProtocolErrorType,
264 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
265 pub rest: Rest,
266}
267
268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
270#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
271#[derive(gproxy_protocol_macros::DeclaredFields)]
272#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
273pub struct RealtimeMcpToolExecutionError {
274 pub message: String,
275 #[serde(rename = "type")]
276 pub type_: RealtimeMcpToolExecutionErrorType,
277 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
278 pub rest: Rest,
279}
280
281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
283#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
284#[derive(gproxy_protocol_macros::DeclaredFields)]
285#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
286pub struct RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilter {
287 #[serde(
288 default,
289 deserialize_with = "present_nullable",
290 skip_serializing_if = "Option::is_none"
291 )]
292 pub read_only: Option<Option<bool>>,
293 #[serde(
294 default,
295 deserialize_with = "present_nullable",
296 skip_serializing_if = "Option::is_none"
297 )]
298 pub tool_names: Option<Option<Vec<String>>>,
299 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
300 pub rest: Rest,
301}
302
303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
305#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
306#[derive(gproxy_protocol_macros::DeclaredFields)]
307#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
308pub struct RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilter {
309 #[serde(
310 default,
311 deserialize_with = "present_nullable",
312 skip_serializing_if = "Option::is_none"
313 )]
314 pub always:
315 Option<Option<RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlways>>,
316 #[serde(
317 default,
318 deserialize_with = "present_nullable",
319 skip_serializing_if = "Option::is_none"
320 )]
321 pub never: Option<Option<RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNever>>,
322 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
323 pub rest: Rest,
324}
325
326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
328#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
329#[derive(gproxy_protocol_macros::DeclaredFields)]
330#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
331pub struct RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlways {
332 #[serde(
333 default,
334 deserialize_with = "present_nullable",
335 skip_serializing_if = "Option::is_none"
336 )]
337 pub read_only: Option<Option<bool>>,
338 #[serde(
339 default,
340 deserialize_with = "present_nullable",
341 skip_serializing_if = "Option::is_none"
342 )]
343 pub tool_names: Option<Option<Vec<String>>>,
344 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
345 pub rest: Rest,
346}
347
348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
350#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
351#[derive(gproxy_protocol_macros::DeclaredFields)]
352#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
353pub struct RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNever {
354 #[serde(
355 default,
356 deserialize_with = "present_nullable",
357 skip_serializing_if = "Option::is_none"
358 )]
359 pub read_only: Option<Option<bool>>,
360 #[serde(
361 default,
362 deserialize_with = "present_nullable",
363 skip_serializing_if = "Option::is_none"
364 )]
365 pub tool_names: Option<Option<Vec<String>>>,
366 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
367 pub rest: Rest,
368}
369
370#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
371#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
372#[derive(gproxy_protocol_macros::DeclaredFields)]
373#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
374pub enum RealtimeMcpApprovalResponseType {
375 #[serde(rename = "mcp_approval_response")]
376 McpApprovalResponse,
377}
378
379#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
380#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
381#[derive(gproxy_protocol_macros::DeclaredFields)]
382#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
383pub enum RealtimeMcpListToolsType {
384 #[serde(rename = "mcp_list_tools")]
385 McpListTools,
386}
387
388#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
389#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
390#[derive(gproxy_protocol_macros::DeclaredFields)]
391#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
392pub enum RealtimeMcpToolCallType {
393 #[serde(rename = "mcp_call")]
394 McpCall,
395}
396
397#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
398#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
399#[derive(gproxy_protocol_macros::DeclaredFields)]
400#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
401pub enum RealtimeMcpApprovalRequestType {
402 #[serde(rename = "mcp_approval_request")]
403 McpApprovalRequest,
404}
405
406#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
407#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
408#[derive(gproxy_protocol_macros::DeclaredFields)]
409#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
410pub enum RealtimeToolsConfigUnionMcpType {
411 #[serde(rename = "mcp")]
412 Mcp,
413}
414
415#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
416#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
417#[derive(gproxy_protocol_macros::DeclaredFields)]
418#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
419pub enum RealtimeToolsConfigUnionMcpAllowedCallersItem {
420 #[serde(rename = "direct")]
421 Direct,
422 #[serde(rename = "programmatic")]
423 Programmatic,
424}
425
426#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
427#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
428#[derive(gproxy_protocol_macros::DeclaredFields)]
429#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
430pub enum RealtimeToolsConfigUnionMcpConnectorId {
431 #[serde(rename = "connector_dropbox")]
432 ConnectorDropbox,
433 #[serde(rename = "connector_gmail")]
434 ConnectorGmail,
435 #[serde(rename = "connector_googlecalendar")]
436 ConnectorGooglecalendar,
437 #[serde(rename = "connector_googledrive")]
438 ConnectorGoogledrive,
439 #[serde(rename = "connector_microsoftteams")]
440 ConnectorMicrosoftteams,
441 #[serde(rename = "connector_outlookcalendar")]
442 ConnectorOutlookcalendar,
443 #[serde(rename = "connector_outlookemail")]
444 ConnectorOutlookemail,
445 #[serde(rename = "connector_sharepoint")]
446 ConnectorSharepoint,
447}
448
449#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
450#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
451#[derive(gproxy_protocol_macros::DeclaredFields)]
452#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
453pub enum RealtimeToolsConfigUnionMcpRequireApprovalVariant2 {
454 #[serde(rename = "always")]
455 Always,
456 #[serde(rename = "never")]
457 Never,
458}
459
460#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
461#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
462#[derive(gproxy_protocol_macros::DeclaredFields)]
463#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
464pub enum RealtimeMcpProtocolErrorType {
465 #[serde(rename = "protocol_error")]
466 ProtocolError,
467}
468
469#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
470#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
471#[derive(gproxy_protocol_macros::DeclaredFields)]
472#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
473pub enum RealtimeMcpToolExecutionErrorType {
474 #[serde(rename = "tool_execution_error")]
475 ToolExecutionError,
476}