use serde_json::{Value, json};
use super::ToolInfo;
use crate::tools::Exposure;
pub const NAME: &str = "codemode";
pub const SNIPPET: &str = "Run JavaScript that calls other tools";
pub const GUIDELINE: &str = "Use codemode to batch independent tool calls (Promise.allSettled), chain them, or filter large output, instead of many separate calls.";
pub fn parameters() -> Value {
json!({"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Raw JavaScript source."}}})
}
pub fn is_codemode_tool(tool: &ToolInfo) -> bool {
tool.name == NAME && tool.exposure == Exposure::ModelOnly && tool.parameters == parameters()
}