use serde::{Deserialize, Serialize}; use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub(super) struct InitializeParams { #[serde(rename = "protocolVersion")] pub(super) protocol_version: String, #[serde(default)] pub(super) capabilities: Value, } #[derive(Debug, Serialize, Deserialize)] pub(super) struct ToolCallParams { pub(super) name: String, #[serde(default, deserialize_with = "deserialize_arguments_object")] pub(super) arguments: Option, /// Story 3.4: the pinned `RequestMetaObject` of this request. Only the validated /// `progressToken` of it is read, and only to decide whether the client asked for out-of-band /// progress; a malformed or foreign `_meta` never fails the call. #[serde(default, rename = "_meta")] pub(super) meta: Option, } /// The pinned `CallToolRequest.params.arguments` is an **optional object**. Omitting it stays valid /// (and keeps its previous behaviour), while an explicit `null`, array or scalar is invalid params — so /// the two cases must not collapse into one another during deserialization. The object shape check /// itself is shared with the `call_tool` proxy's nested `arguments` (`protocol::deserialize_object_only`). fn deserialize_arguments_object<'de, D>(deserializer: D) -> Result, D::Error> where D: serde::Deserializer<'de>, { crate::protocol::deserialize_object_only(deserializer).map(Some) } #[derive(Debug, Deserialize)] pub(super) struct ApprovalDecisionPayload { pub(super) approve: String, #[serde(default)] pub(super) note: Option, }