Skip to main content

atomr_agents_tool/
descriptor.rs

1use atomr_agents_core::{ToolId, Value};
2use serde::{Deserialize, Serialize};
3
4/// Descriptor advertised to the model. The schema is JSON-Schema
5/// shaped; per-provider renderers in this crate adapt it to OpenAI /
6/// Anthropic / Gemini call formats.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct ToolDescriptor {
9    pub id: ToolId,
10    pub name: String,
11    pub description: String,
12    pub schema: ToolSchema,
13}
14
15/// JSON-Schema fragment for the tool's arguments.
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct ToolSchema(pub Value);
18
19impl ToolSchema {
20    pub fn empty_object() -> Self {
21        Self(serde_json::json!({"type": "object", "properties": {}}))
22    }
23}