Skip to main content

gproxy_protocol/claude/common/tools/
defs.rs

1use serde::{Deserialize, Serialize};
2
3use super::super::{CacheControl, CitationConfig, ClaudeModel, McpToolset, ResponseInclusion};
4use super::wire::*;
5use super::{CustomToolType, JsonSchema, ToolCommon, ToolCommonWithoutInputExamples, UserLocation};
6
7#[derive(Debug, Clone, PartialEq, Serialize)]
8#[serde(untagged)]
9#[non_exhaustive]
10pub enum Tool {
11    WebFetch(WebFetchTool),
12    WebSearch(WebSearchTool),
13    Advisor(AdvisorTool),
14    Computer(ComputerTool),
15    TextEditor(TextEditorTool),
16    Command(CommandTool),
17    McpToolset(McpToolset),
18    Custom(CustomTool),
19    Unknown(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 CustomTool {
25    pub input_schema: JsonSchema,
26    pub name: String,
27    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
28    pub type_: Option<CustomToolType>,
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub description: Option<String>,
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub eager_input_streaming: Option<bool>,
33    #[serde(flatten)]
34    pub common: ToolCommon,
35    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
36    pub rest: serde_json::Map<String, serde_json::Value>,
37}
38
39#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
40#[serde(untagged)]
41#[non_exhaustive]
42pub enum CommandTool {
43    Bash20241022(BashTool20241022),
44    Bash20250124(BashTool20250124),
45    CodeExecution20250522(CodeExecutionTool20250522),
46    CodeExecution20250825(CodeExecutionTool20250825),
47    CodeExecution20260120(CodeExecutionTool20260120),
48    CodeExecution20260521(CodeExecutionTool20260521),
49    Memory20250818(MemoryTool20250818),
50    ToolSearchBm25(ToolSearchBm25Tool),
51    ToolSearchRegex(ToolSearchRegexTool),
52    Raw(serde_json::Value),
53}
54
55#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
56#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
57pub struct BashTool20241022 {
58    pub name: BashToolName,
59    #[serde(rename = "type")]
60    pub type_: BashTool20241022Type,
61    #[serde(flatten)]
62    pub common: ToolCommon,
63    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
64    pub rest: serde_json::Map<String, serde_json::Value>,
65}
66
67#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
68#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
69pub struct BashTool20250124 {
70    pub name: BashToolName,
71    #[serde(rename = "type")]
72    pub type_: BashTool20250124Type,
73    #[serde(flatten)]
74    pub common: ToolCommon,
75    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
76    pub rest: serde_json::Map<String, serde_json::Value>,
77}
78
79#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
80#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
81pub struct CodeExecutionTool20250522 {
82    pub name: CodeExecutionToolName,
83    #[serde(rename = "type")]
84    pub type_: CodeExecutionTool20250522Type,
85    #[serde(flatten)]
86    pub common: ToolCommonWithoutInputExamples,
87    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
88    pub rest: serde_json::Map<String, serde_json::Value>,
89}
90
91#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
92#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
93pub struct CodeExecutionTool20250825 {
94    pub name: CodeExecutionToolName,
95    #[serde(rename = "type")]
96    pub type_: CodeExecutionTool20250825Type,
97    #[serde(flatten)]
98    pub common: ToolCommonWithoutInputExamples,
99    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
100    pub rest: serde_json::Map<String, serde_json::Value>,
101}
102
103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
104#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
105pub struct CodeExecutionTool20260120 {
106    pub name: CodeExecutionToolName,
107    #[serde(rename = "type")]
108    pub type_: CodeExecutionTool20260120Type,
109    #[serde(flatten)]
110    pub common: ToolCommonWithoutInputExamples,
111    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
112    pub rest: serde_json::Map<String, serde_json::Value>,
113}
114
115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
116#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
117pub struct CodeExecutionTool20260521 {
118    pub name: CodeExecutionToolName,
119    #[serde(rename = "type")]
120    pub type_: CodeExecutionTool20260521Type,
121    #[serde(flatten)]
122    pub common: ToolCommonWithoutInputExamples,
123    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
124    pub rest: serde_json::Map<String, serde_json::Value>,
125}
126
127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
128#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
129pub struct MemoryTool20250818 {
130    pub name: MemoryToolName,
131    #[serde(rename = "type")]
132    pub type_: MemoryTool20250818Type,
133    #[serde(flatten)]
134    pub common: ToolCommon,
135    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
136    pub rest: serde_json::Map<String, serde_json::Value>,
137}
138
139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
140#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
141pub struct ToolSearchBm25Tool {
142    pub name: ToolSearchBm25ToolName,
143    #[serde(rename = "type")]
144    pub type_: ToolSearchBm25ToolType,
145    #[serde(flatten)]
146    pub common: ToolCommonWithoutInputExamples,
147    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
148    pub rest: serde_json::Map<String, serde_json::Value>,
149}
150
151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
152#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
153pub struct ToolSearchRegexTool {
154    pub name: ToolSearchRegexToolName,
155    #[serde(rename = "type")]
156    pub type_: ToolSearchRegexToolType,
157    #[serde(flatten)]
158    pub common: ToolCommonWithoutInputExamples,
159    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
160    pub rest: serde_json::Map<String, serde_json::Value>,
161}
162
163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
164#[serde(untagged)]
165#[non_exhaustive]
166pub enum TextEditorTool {
167    TextEditor20241022(TextEditorTool20241022),
168    TextEditor20250124(TextEditorTool20250124),
169    TextEditor20250429(TextEditorTool20250429),
170    TextEditor20250728(TextEditorTool20250728),
171    Raw(serde_json::Value),
172}
173
174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
175#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
176pub struct TextEditorTool20241022 {
177    pub name: StrReplaceEditorToolName,
178    #[serde(rename = "type")]
179    pub type_: TextEditorTool20241022Type,
180    #[serde(flatten)]
181    pub common: ToolCommon,
182    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
183    pub rest: serde_json::Map<String, serde_json::Value>,
184}
185
186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
187#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
188pub struct TextEditorTool20250124 {
189    pub name: StrReplaceEditorToolName,
190    #[serde(rename = "type")]
191    pub type_: TextEditorTool20250124Type,
192    #[serde(flatten)]
193    pub common: ToolCommon,
194    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
195    pub rest: serde_json::Map<String, serde_json::Value>,
196}
197
198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
199#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
200pub struct TextEditorTool20250429 {
201    pub name: StrReplaceBasedEditToolName,
202    #[serde(rename = "type")]
203    pub type_: TextEditorTool20250429Type,
204    #[serde(flatten)]
205    pub common: ToolCommon,
206    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
207    pub rest: serde_json::Map<String, serde_json::Value>,
208}
209
210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
211#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
212pub struct TextEditorTool20250728 {
213    pub name: StrReplaceBasedEditToolName,
214    #[serde(rename = "type")]
215    pub type_: TextEditorTool20250728Type,
216    #[serde(skip_serializing_if = "Option::is_none")]
217    pub max_characters: Option<u64>,
218    #[serde(flatten)]
219    pub common: ToolCommon,
220    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
221    pub rest: serde_json::Map<String, serde_json::Value>,
222}
223
224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
225#[serde(untagged)]
226#[non_exhaustive]
227pub enum ComputerTool {
228    Computer20241022(ComputerTool20241022),
229    Computer20250124(ComputerTool20250124),
230    Computer20251124(ComputerTool20251124),
231    Raw(serde_json::Value),
232}
233
234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
235#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
236pub struct ComputerTool20241022 {
237    pub display_height_px: u64,
238    pub display_width_px: u64,
239    pub name: ComputerToolName,
240    #[serde(rename = "type")]
241    pub type_: ComputerTool20241022Type,
242    #[serde(skip_serializing_if = "Option::is_none")]
243    pub display_number: Option<u64>,
244    #[serde(flatten)]
245    pub common: ToolCommon,
246    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
247    pub rest: serde_json::Map<String, serde_json::Value>,
248}
249
250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
251#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
252pub struct ComputerTool20250124 {
253    pub display_height_px: u64,
254    pub display_width_px: u64,
255    pub name: ComputerToolName,
256    #[serde(rename = "type")]
257    pub type_: ComputerTool20250124Type,
258    #[serde(skip_serializing_if = "Option::is_none")]
259    pub display_number: Option<u64>,
260    #[serde(flatten)]
261    pub common: ToolCommon,
262    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
263    pub rest: serde_json::Map<String, serde_json::Value>,
264}
265
266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
267#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
268pub struct ComputerTool20251124 {
269    pub display_height_px: u64,
270    pub display_width_px: u64,
271    pub name: ComputerToolName,
272    #[serde(rename = "type")]
273    pub type_: ComputerTool20251124Type,
274    #[serde(skip_serializing_if = "Option::is_none")]
275    pub display_number: Option<u64>,
276    #[serde(skip_serializing_if = "Option::is_none")]
277    pub enable_zoom: Option<bool>,
278    #[serde(flatten)]
279    pub common: ToolCommon,
280    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
281    pub rest: serde_json::Map<String, serde_json::Value>,
282}
283
284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
285#[serde(untagged)]
286#[non_exhaustive]
287pub enum WebSearchTool {
288    WebSearch20250305(WebSearchTool20250305),
289    WebSearch20260209(WebSearchTool20260209),
290    WebSearch20260318(WebSearchTool20260318),
291    Raw(serde_json::Value),
292}
293
294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
295#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
296pub struct WebSearchTool20250305 {
297    pub name: WebSearchToolName,
298    #[serde(rename = "type")]
299    pub type_: WebSearchTool20250305Type,
300    #[serde(flatten)]
301    pub params: WebSearchToolParams,
302    #[serde(flatten)]
303    pub common: ToolCommonWithoutInputExamples,
304    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
305    pub rest: serde_json::Map<String, serde_json::Value>,
306}
307
308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
309#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
310pub struct WebSearchTool20260209 {
311    pub name: WebSearchToolName,
312    #[serde(rename = "type")]
313    pub type_: WebSearchTool20260209Type,
314    #[serde(flatten)]
315    pub params: WebSearchToolParams,
316    #[serde(flatten)]
317    pub common: ToolCommonWithoutInputExamples,
318    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
319    pub rest: serde_json::Map<String, serde_json::Value>,
320}
321
322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
323#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
324pub struct WebSearchTool20260318 {
325    pub name: WebSearchToolName,
326    #[serde(rename = "type")]
327    pub type_: WebSearchTool20260318Type,
328    #[serde(flatten)]
329    pub params: WebSearchToolParams,
330    #[serde(skip_serializing_if = "Option::is_none")]
331    pub response_inclusion: Option<ResponseInclusion>,
332    #[serde(flatten)]
333    pub common: ToolCommonWithoutInputExamples,
334    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
335    pub rest: serde_json::Map<String, serde_json::Value>,
336}
337
338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
339#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
340pub struct WebSearchToolParams {
341    #[serde(skip_serializing_if = "Option::is_none")]
342    pub allowed_domains: Option<Vec<String>>,
343    #[serde(skip_serializing_if = "Option::is_none")]
344    pub blocked_domains: Option<Vec<String>>,
345    #[serde(skip_serializing_if = "Option::is_none")]
346    pub max_uses: Option<u64>,
347    #[serde(skip_serializing_if = "Option::is_none")]
348    pub user_location: Option<UserLocation>,
349    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
350    pub rest: serde_json::Map<String, serde_json::Value>,
351}
352
353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
354#[serde(untagged)]
355#[non_exhaustive]
356pub enum WebFetchTool {
357    WebFetch20250910(WebFetchTool20250910),
358    WebFetch20260209(WebFetchTool20260209),
359    WebFetch20260309(WebFetchTool20260309),
360    WebFetch20260318(WebFetchTool20260318),
361    Raw(serde_json::Value),
362}
363
364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
365#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
366pub struct WebFetchTool20250910 {
367    pub name: WebFetchToolName,
368    #[serde(rename = "type")]
369    pub type_: WebFetchTool20250910Type,
370    #[serde(flatten)]
371    pub params: WebFetchToolParams,
372    #[serde(flatten)]
373    pub common: ToolCommonWithoutInputExamples,
374    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
375    pub rest: serde_json::Map<String, serde_json::Value>,
376}
377
378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
379#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
380pub struct WebFetchTool20260209 {
381    pub name: WebFetchToolName,
382    #[serde(rename = "type")]
383    pub type_: WebFetchTool20260209Type,
384    #[serde(flatten)]
385    pub params: WebFetchToolParams,
386    #[serde(flatten)]
387    pub common: ToolCommonWithoutInputExamples,
388    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
389    pub rest: serde_json::Map<String, serde_json::Value>,
390}
391
392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
393#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
394pub struct WebFetchTool20260309 {
395    pub name: WebFetchToolName,
396    #[serde(rename = "type")]
397    pub type_: WebFetchTool20260309Type,
398    #[serde(flatten)]
399    pub params: WebFetchToolParams,
400    #[serde(skip_serializing_if = "Option::is_none")]
401    pub use_cache: Option<bool>,
402    #[serde(flatten)]
403    pub common: ToolCommonWithoutInputExamples,
404    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
405    pub rest: serde_json::Map<String, serde_json::Value>,
406}
407
408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
409#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
410pub struct WebFetchTool20260318 {
411    pub name: WebFetchToolName,
412    #[serde(rename = "type")]
413    pub type_: WebFetchTool20260318Type,
414    #[serde(flatten)]
415    pub params: WebFetchToolParams,
416    #[serde(skip_serializing_if = "Option::is_none")]
417    pub response_inclusion: Option<ResponseInclusion>,
418    #[serde(skip_serializing_if = "Option::is_none")]
419    pub use_cache: Option<bool>,
420    #[serde(flatten)]
421    pub common: ToolCommonWithoutInputExamples,
422    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
423    pub rest: serde_json::Map<String, serde_json::Value>,
424}
425
426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
427#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
428pub struct WebFetchToolParams {
429    #[serde(skip_serializing_if = "Option::is_none")]
430    pub allowed_domains: Option<Vec<String>>,
431    #[serde(skip_serializing_if = "Option::is_none")]
432    pub blocked_domains: Option<Vec<String>>,
433    #[serde(skip_serializing_if = "Option::is_none")]
434    pub citations: Option<CitationConfig>,
435    #[serde(skip_serializing_if = "Option::is_none")]
436    pub max_content_tokens: Option<u64>,
437    #[serde(skip_serializing_if = "Option::is_none")]
438    pub max_uses: Option<u64>,
439    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
440    pub rest: serde_json::Map<String, serde_json::Value>,
441}
442
443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
444#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
445pub struct AdvisorTool {
446    pub model: ClaudeModel,
447    pub name: AdvisorToolName,
448    #[serde(rename = "type")]
449    pub type_: AdvisorTool20260301Type,
450    #[serde(skip_serializing_if = "Option::is_none")]
451    pub caching: Option<CacheControl>,
452    /// Bounds the advisor's total output (thinking + text) per call.
453    #[serde(skip_serializing_if = "Option::is_none")]
454    pub max_tokens: Option<u64>,
455    #[serde(skip_serializing_if = "Option::is_none")]
456    pub max_uses: Option<u64>,
457    #[serde(flatten)]
458    pub common: ToolCommonWithoutInputExamples,
459    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
460    pub rest: serde_json::Map<String, serde_json::Value>,
461}