Skip to main content

gproxy_protocol/protocol/claude/common/tools/
caller.rs

1use serde::{Deserialize, Serialize};
2
3use super::super::{JsonObject, TypedObject};
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6#[serde(untagged)]
7#[non_exhaustive]
8pub enum Caller {
9    Direct(DirectCaller),
10    ServerTool(ServerToolCaller),
11    ServerTool20260120(ServerToolCaller20260120),
12    ServerTool20260521(ServerToolCaller20260521),
13    Unknown(TypedObject),
14}
15
16#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
17#[non_exhaustive]
18pub struct DirectCaller {
19    #[serde(rename = "type")]
20    pub type_: DirectCallerType,
21    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
22    pub extra: JsonObject,
23}
24
25#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
26#[non_exhaustive]
27pub enum DirectCallerType {
28    #[serde(rename = "direct")]
29    Direct,
30}
31
32#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
33#[non_exhaustive]
34pub struct ServerToolCaller {
35    pub tool_id: String,
36    #[serde(rename = "type")]
37    pub type_: ServerToolCallerType,
38    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
39    pub extra: JsonObject,
40}
41
42#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
43#[non_exhaustive]
44pub enum ServerToolCallerType {
45    #[serde(rename = "code_execution_20250825")]
46    CodeExecution20250825,
47}
48
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
50#[non_exhaustive]
51pub struct ServerToolCaller20260120 {
52    pub tool_id: String,
53    #[serde(rename = "type")]
54    pub type_: ServerToolCaller20260120Type,
55    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
56    pub extra: JsonObject,
57}
58
59#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
60#[non_exhaustive]
61pub enum ServerToolCaller20260120Type {
62    #[serde(rename = "code_execution_20260120")]
63    CodeExecution20260120,
64}
65
66#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
67#[non_exhaustive]
68pub struct ServerToolCaller20260521 {
69    pub tool_id: String,
70    #[serde(rename = "type")]
71    pub type_: ServerToolCaller20260521Type,
72    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
73    pub extra: JsonObject,
74}
75
76#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
77#[non_exhaustive]
78pub enum ServerToolCaller20260521Type {
79    #[serde(rename = "code_execution_20260521")]
80    CodeExecution20260521,
81}