defect_core/tool.rs
1//! Tool schema — the wire-facing description of a tool's parameters.
2//!
3//! This is the minimal, self-contained piece of the tool layer that providers need:
4//! `defect-llm` serializes [`ToolSchema`] into provider wire JSON. The full tool trait,
5//! `ToolContext`, and runtime plumbing live in `defect-agent::tool` (they depend on the
6//! session runtime and so cannot live here).
7
8use serde::{Deserialize, Serialize};
9
10/// A tool's wire-facing schema: name, description, and a JSON Schema for its parameters.
11///
12/// Providers don't hold `dyn Tool`; they serialize schemas into wire JSON.
13#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14pub struct ToolSchema {
15 pub name: String,
16 pub description: String,
17 /// JSON Schema for the parameters. Uses a subset of Draft 2020-12 (the exact subset
18 /// and escaping rules are documented in `tool-trait.md`).
19 pub input_schema: serde_json::Value,
20}