1use serde::{Deserialize, Serialize};
2
3use super::super::server_tools::ResponseWebSearchToolResultContent;
4use super::super::{Caller, Citation, JsonObject, ServerToolUseName, StringOrArray};
5use super::{
6 CompactionBlockType, ContainerUploadBlockType, ServerToolUseBlockType, TextBlockType,
7 ToolUseBlockType, WebSearchResultBlockType, WebSearchToolResultBlockType,
8};
9
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
11#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
12pub struct ResponseTextBlock {
13 #[serde(skip_serializing_if = "Option::is_none")]
14 pub citations: Option<Vec<Citation>>,
15 pub text: String,
16 #[serde(rename = "type")]
17 pub type_: TextBlockType,
18 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
19 pub rest: serde_json::Map<String, serde_json::Value>,
20}
21
22#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
23#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
24pub struct ResponseToolUseBlock {
25 pub id: String,
26 pub input: JsonObject,
27 pub name: String,
28 #[serde(rename = "type")]
29 pub type_: ToolUseBlockType,
30 #[serde(skip_serializing_if = "Option::is_none")]
31 pub caller: Option<Caller>,
32 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
33 pub rest: serde_json::Map<String, serde_json::Value>,
34}
35
36#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
37#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
38pub struct ResponseServerToolUseBlock {
39 pub id: String,
40 pub input: JsonObject,
41 pub name: ServerToolUseName,
42 #[serde(rename = "type")]
43 pub type_: ServerToolUseBlockType,
44 #[serde(skip_serializing_if = "Option::is_none")]
45 pub caller: Option<Caller>,
46 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
47 pub rest: serde_json::Map<String, serde_json::Value>,
48}
49
50#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
51#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
52pub struct ResponseWebSearchToolResultBlock {
53 pub content: ResponseWebSearchToolResultContent,
54 pub tool_use_id: String,
55 #[serde(rename = "type")]
56 pub type_: WebSearchToolResultBlockType,
57 #[serde(skip_serializing_if = "Option::is_none")]
58 pub caller: Option<Caller>,
59 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
60 pub rest: serde_json::Map<String, serde_json::Value>,
61}
62
63#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
64#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
65pub struct ResponseWebSearchResultBlock {
66 pub encrypted_content: String,
67 #[serde(skip_serializing_if = "Option::is_none")]
68 pub page_age: Option<String>,
69 pub title: String,
70 #[serde(rename = "type")]
71 pub type_: WebSearchResultBlockType,
72 pub url: String,
73 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
74 pub rest: serde_json::Map<String, serde_json::Value>,
75}
76
77#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
78#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
79pub struct ResponseToolReferenceBlock {
80 pub tool_name: String,
81 #[serde(rename = "type")]
82 pub type_: ResponseToolReferenceBlockType,
83 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
84 pub rest: serde_json::Map<String, serde_json::Value>,
85}
86
87#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
88#[non_exhaustive]
89pub enum ResponseToolReferenceBlockType {
90 #[serde(rename = "tool_reference")]
91 ToolReference,
92}
93
94#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
95#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
96pub struct ResponseMcpToolUseBlock {
97 pub id: String,
98 pub input: JsonObject,
99 pub name: String,
100 pub server_name: String,
101 #[serde(rename = "type")]
102 pub type_: ResponseMcpToolUseBlockType,
103 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
104 pub rest: serde_json::Map<String, serde_json::Value>,
105}
106
107#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
108#[non_exhaustive]
109pub enum ResponseMcpToolUseBlockType {
110 #[serde(rename = "mcp_tool_use")]
111 McpToolUse,
112}
113
114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
115#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
116pub struct ResponseMcpToolResultBlock {
117 pub content: ResponseMcpToolResultContent,
118 pub is_error: bool,
119 pub tool_use_id: String,
120 #[serde(rename = "type")]
121 pub type_: ResponseMcpToolResultBlockType,
122 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
123 pub rest: serde_json::Map<String, serde_json::Value>,
124}
125
126#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
127#[non_exhaustive]
128pub enum ResponseMcpToolResultBlockType {
129 #[serde(rename = "mcp_tool_result")]
130 McpToolResult,
131}
132
133pub type ResponseMcpToolResultContent = StringOrArray<ResponseTextBlock>;
134
135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
136#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
137pub struct ResponseContainerUploadBlock {
138 pub file_id: String,
139 #[serde(rename = "type")]
140 pub type_: ContainerUploadBlockType,
141 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
142 pub rest: serde_json::Map<String, serde_json::Value>,
143}
144
145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
146#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
147pub struct ResponseCompactionBlock {
148 pub content: Option<String>,
149 pub encrypted_content: String,
150 #[serde(rename = "type")]
151 pub type_: CompactionBlockType,
152 #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
153 pub rest: serde_json::Map<String, serde_json::Value>,
154}