mermaid_cli/models/tool_call.rs
1//! Wire-format tool call type.
2//!
3//! Matches the OpenAI / Ollama `tool_calls` array shape — an `id`
4//! string plus a `function` object of `{name, arguments}`. Every
5//! provider adapter emits this shape via `StreamEvent::ToolCall`; the
6//! reducer wraps it in a `PendingToolCall` with an internal
7//! `ToolCallId` and the effect runner dispatches by `function.name`
8//! into the `ToolRegistry`.
9
10use serde::{Deserialize, Serialize};
11
12/// A tool call from the model (OpenAI / Ollama wire format).
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct ToolCall {
15 #[serde(default)]
16 pub id: Option<String>,
17 pub function: FunctionCall,
18}
19
20/// Function call details.
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct FunctionCall {
23 pub name: String,
24 pub arguments: serde_json::Value,
25}