windmill_api/models/agent_tool.rs
1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.864.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// AgentTool : A tool available to an AI agent. Can be a flow module or an external MCP (Model Context Protocol) tool
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct AgentTool {
17 /// Unique identifier for this tool. Cannot contain spaces - use underscores instead (e.g., 'get_user_data' not 'get user data')
18 #[serde(rename = "id")]
19 pub id: String,
20 /// The name the AI agent calls this tool by, not a human label. On a flowmodule tool it must match ^[a-zA-Z0-9_]+$ - letters, numbers and underscores only (e.g. 'search_documentation', not 'Search documentation') - and always be set; on an mcp, websearch or question tool it is a plain label. Put the human-readable explanation in 'description'.
21 #[serde(rename = "summary", skip_serializing_if = "Option::is_none")]
22 pub summary: Option<String>,
23 /// Free-text description of the tool given to the AI to decide when and how to call it. Overrides the description auto-derived from the underlying script.
24 #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
25 pub description: Option<String>,
26 /// Scopes the token of this tool's jobs is restricted to, on top of the agent step's own restriction: a tool can only narrow it.
27 #[serde(rename = "job_token_scopes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28 pub job_token_scopes: Option<Option<Vec<String>>>,
29 /// Flowmodule and mcp tools only. Each call waits for a person to approve or reject it from the flow's run page or chat, without the agent holding a worker. Calls in the same turn that do not require approval run right away. A rejected call, or one nobody answers within 30 minutes, is reported to the AI as not run.
30 #[serde(rename = "requires_approval", skip_serializing_if = "Option::is_none")]
31 pub requires_approval: Option<bool>,
32 #[serde(rename = "value")]
33 pub value: Box<models::ToolValue>,
34}
35
36impl AgentTool {
37 /// A tool available to an AI agent. Can be a flow module or an external MCP (Model Context Protocol) tool
38 pub fn new(id: String, value: models::ToolValue) -> AgentTool {
39 AgentTool {
40 id,
41 summary: None,
42 description: None,
43 job_token_scopes: None,
44 requires_approval: None,
45 value: Box::new(value),
46 }
47 }
48}
49