Skip to main content

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.824.1
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 or websearch 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    #[serde(rename = "value")]
30    pub value: Box<models::ToolValue>,
31}
32
33impl AgentTool {
34    /// A tool available to an AI agent. Can be a flow module or an external MCP (Model Context Protocol) tool
35    pub fn new(id: String, value: models::ToolValue) -> AgentTool {
36        AgentTool {
37            id,
38            summary: None,
39            description: None,
40            job_token_scopes: None,
41            value: Box::new(value),
42        }
43    }
44}
45