use crate::ui::openai::{ToolDef, ToolFn};
use once_cell::sync::Lazy;
use serde_json::json;
pub static TOOL_DEFS: Lazy<Vec<ToolDef>> = Lazy::new(|| {
vec![
ToolDef {
kind: "function",
function: ToolFn {
name: "validate_card",
description: "Validate an Adaptive Card against v1.6 schema, accessibility \
rules, and (optionally) a target host's capabilities.",
parameters: json!({
"type": "object",
"properties": {
"card": { "type": "object" },
"host": {
"type": "string",
"enum": ["generic","teams","outlook","webchat","windows","viva_connections","webex"]
}
},
"required": ["card"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "analyze_card",
description: "Report element count, action count, nesting depth, and \
duplicate IDs for an Adaptive Card.",
parameters: json!({
"type": "object",
"properties": { "card": {"type": "object"} },
"required": ["card"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "check_accessibility",
description: "Score an Adaptive Card's accessibility on 0-100 with a list of \
issues and fix hints.",
parameters: json!({
"type": "object",
"properties": { "card": {"type": "object"} },
"required": ["card"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "suggest_layout",
description: "Suggest knowledge base example entries that match a free-text query.",
parameters: json!({
"type": "object",
"properties": {
"query": { "type": "string" },
"limit": { "type": "integer", "minimum": 1, "default": 5 }
},
"required": ["query"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "optimize_card",
description: "Apply accessibility, performance, and modernization optimizations \
to a card, optionally adapting it for a target host.",
parameters: json!({
"type": "object",
"properties": {
"card": { "type": "object" },
"accessibility": { "type": "boolean", "default": false },
"performance": { "type": "boolean", "default": false },
"modernize": { "type": "boolean", "default": false },
"target_host": {
"type": "string",
"enum": ["generic","teams","outlook","webchat","windows","viva_connections","webex"]
}
},
"required": ["card"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "transform_card",
description: "Transform a card to a target schema version and/or target host, \
stripping or downgrading unsupported features.",
parameters: json!({
"type": "object",
"properties": {
"card": { "type": "object" },
"target_version": {
"type": "string",
"enum": ["1.0","1.1","1.2","1.3","1.4","1.5","1.6"]
},
"target_host": {
"type": "string",
"enum": ["generic","teams","outlook","webchat","windows","viva_connections","webex"]
},
"strict": { "type": "boolean", "default": false }
},
"required": ["card"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "template_card",
description: "Convert a static Adaptive Card into a data-bound template with \
${expr} bindings and sample data.",
parameters: json!({
"type": "object",
"properties": { "card": {"type": "object"} },
"required": ["card"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "data_to_card",
description: "Generate an Adaptive Card from arbitrary structured data using a \
chosen presentation (table, factset, list, chart, auto).",
parameters: json!({
"type": "object",
"properties": {
"data": {},
"title": { "type": "string" },
"presentation": {
"type": "string",
"enum": ["table","factset","list","chart","auto"]
},
"host": {
"type": "string",
"enum": ["generic","teams","outlook","webchat","windows","viva_connections","webex"]
}
},
"required": ["data"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "list_examples",
description: "List knowledge base examples, optionally filtered by category.",
parameters: json!({
"type": "object",
"properties": {
"category": { "type": "string" },
"limit": { "type": "integer", "minimum": 1, "default": 20 }
}
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "get_example",
description: "Fetch a single knowledge base example by id.",
parameters: json!({
"type": "object",
"properties": { "id": {"type": "string"} },
"required": ["id"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "pack_card",
description: "Package one or more Adaptive Cards into a .gtpack archive (stub).",
parameters: json!({
"type": "object",
"properties": {
"name": { "type": "string" },
"cards": { "type": "array", "items": { "type": "object" } }
},
"required": ["name", "cards"]
}),
},
},
ToolDef {
kind: "function",
function: ToolFn {
name: "deploy_pack",
description: "Deploy a previously-built .gtpack archive to the runner (stub).",
parameters: json!({
"type": "object",
"properties": {
"pack_path": { "type": "string" }
},
"required": ["pack_path"]
}),
},
},
]
});