Skip to main content

objectiveai_sdk/mcp/tool/
tool_execution.rs

1//! Tool execution properties.
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6/// The tool's preference for task-augmented execution.
7#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
8#[serde(rename_all = "lowercase")]
9#[schemars(rename = "mcp.tool.TaskSupport")]
10pub enum TaskSupport {
11    /// Clients MUST invoke the tool as a task.
12    #[schemars(title = "Required")]
13    Required,
14    /// Clients MAY invoke the tool as a task or normal request.
15    #[schemars(title = "Optional")]
16    Optional,
17    /// Clients MUST NOT attempt to invoke the tool as a task.
18    #[schemars(title = "Forbidden")]
19    Forbidden,
20}
21
22/// Execution-related properties for a tool.
23#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
24#[schemars(rename = "mcp.tool.ToolExecution")]
25pub struct ToolExecution {
26    /// Indicates the tool's preference for task-augmented execution.
27    /// Defaults to "forbidden" if not present.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    #[schemars(extend("omitempty" = true))]
30    #[serde(rename = "taskSupport")]
31    pub task_support: Option<TaskSupport>,
32}