Files
crank/crates/crank-community-mcp/src/app/request.rs
T
Hermes DevOps 301dce301a [skip ci] wip: preserve Hermes crank development checkpoint
Owner-authorized recovery of accumulated source changes.
Includes accepted work and in-progress changes; NOT a release or acceptance.
Parent baseline 1b6db09bd1. Runtime data, build caches and local credentials excluded.
2026-10-25 08:05:37 +00:00

36 lines
1.3 KiB
Rust

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<Value>,
}
/// 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<Option<Value>, 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<String>,
}