use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.Payload")]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Payload {
#[schemars(title = "Initialize")]
Initialize {
mcp_kind: super::super::McpKind,
#[serde(flatten)]
result: JsonRpcResult<InitializeReply>,
},
#[schemars(title = "ToolsList")]
ToolsList {
mcp_kind: super::super::McpKind,
#[serde(flatten)]
result: JsonRpcResult<crate::mcp::tool::ListToolsResult>,
},
#[schemars(title = "ToolsCall")]
ToolsCall {
mcp_kind: super::super::McpKind,
#[serde(flatten)]
result: JsonRpcResult<crate::mcp::tool::CallToolResult>,
},
#[schemars(title = "ResourcesList")]
ResourcesList {
mcp_kind: super::super::McpKind,
#[serde(flatten)]
result: JsonRpcResult<crate::mcp::resource::ListResourcesResult>,
},
#[schemars(title = "ResourcesRead")]
ResourcesRead {
mcp_kind: super::super::McpKind,
#[serde(flatten)]
result: JsonRpcResult<crate::mcp::resource::ReadResourceResult>,
},
#[schemars(title = "SessionTerminate")]
SessionTerminate {
mcp_kind: super::super::McpKind,
#[serde(flatten)]
result: JsonRpcResult<()>,
},
#[schemars(title = "ReadMessageQueue")]
ReadMessageQueue(JsonRpcResult<ReadMessageQueueResult>),
#[schemars(title = "Retrieve")]
Retrieve(JsonRpcResult<super::super::retrieve::Response>),
#[schemars(title = "Script")]
Script(JsonRpcResult<ScriptResult>),
#[schemars(title = "Drop")]
Drop(DropResult),
#[schemars(title = "LaboratoryExportBegin")]
LaboratoryExportBegin(JsonRpcResult<LaboratoryTransferBeginResult>),
#[schemars(title = "LaboratoryExportRead")]
LaboratoryExportRead(JsonRpcResult<LaboratoryExportChunk>),
#[schemars(title = "LaboratoryExportAbort")]
LaboratoryExportAbort(JsonRpcResult<LaboratoryTransferAck>),
#[schemars(title = "LaboratoryImportBegin")]
LaboratoryImportBegin(JsonRpcResult<LaboratoryTransferBeginResult>),
#[schemars(title = "LaboratoryImportWrite")]
LaboratoryImportWrite(JsonRpcResult<LaboratoryTransferAck>),
#[schemars(title = "LaboratoryImportEnd")]
LaboratoryImportEnd(JsonRpcResult<LaboratoryImportEndResult>),
#[schemars(title = "LaboratoryImportAbort")]
LaboratoryImportAbort(JsonRpcResult<LaboratoryTransferAck>),
#[schemars(title = "LaboratoryTransfer")]
LaboratoryTransfer(JsonRpcResult<LaboratoryTransferResult>),
#[schemars(title = "LaboratoryLocalTransfer")]
LaboratoryLocalTransfer(JsonRpcResult<LaboratoryTransferResult>),
}
impl Payload {
pub fn mcp_kind(&self) -> Option<super::super::McpKind> {
match self {
Payload::Initialize { mcp_kind, .. }
| Payload::ToolsList { mcp_kind, .. }
| Payload::ToolsCall { mcp_kind, .. }
| Payload::ResourcesList { mcp_kind, .. }
| Payload::ResourcesRead { mcp_kind, .. }
| Payload::SessionTerminate { mcp_kind, .. } => Some(mcp_kind.clone()),
Payload::ReadMessageQueue(_)
| Payload::Retrieve(_)
| Payload::Script(_)
| Payload::Drop(_)
| Payload::LaboratoryExportBegin(_)
| Payload::LaboratoryExportRead(_)
| Payload::LaboratoryExportAbort(_)
| Payload::LaboratoryImportBegin(_)
| Payload::LaboratoryImportWrite(_)
| Payload::LaboratoryImportEnd(_)
| Payload::LaboratoryImportAbort(_)
| Payload::LaboratoryTransfer(_)
| Payload::LaboratoryLocalTransfer(_) => None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.ReadMessageQueueResult")]
pub struct ReadMessageQueueResult {
pub rows: Vec<ReadMessageQueueRow>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.DropResult")]
pub struct DropResult {
pub dropped: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.LaboratoryTransferBeginResult")]
pub struct LaboratoryTransferBeginResult {
pub transfer_id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.LaboratoryExportChunk")]
pub struct LaboratoryExportChunk {
pub data: String,
pub eof: bool,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.LaboratoryTransferAck")]
pub struct LaboratoryTransferAck {}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.LaboratoryImportEndResult")]
pub struct LaboratoryImportEndResult {
pub bytes: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.LaboratoryTransferResult")]
pub struct LaboratoryTransferResult {
pub bytes: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.ReadMessageQueueRow")]
pub struct ReadMessageQueueRow {
pub content_ids: Vec<i64>,
pub rich_content: crate::agent::completions::message::RichContent,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.InitializeReply")]
pub struct InitializeReply {
pub mcp_session_id: String,
pub result: crate::mcp::initialize_result::InitializeResult,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.JsonRpcResult.{R}", bound = "R: JsonSchema")]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum JsonRpcResult<R> {
#[schemars(title = "Ok")]
Ok { result: R },
#[schemars(title = "Err")]
Err {
code: i64,
message: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[schemars(extend("omitempty" = true))]
data: Option<serde_json::Value>,
},
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "client_objectiveai_mcp.server_response.ScriptResult")]
pub struct ScriptResult {
pub messages: Vec<crate::agent::script::OutputMessage>,
}