1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! Input structs for the MCP tools defined in `mcp.rs`, split out to keep that file under the
//! repo's 500-line-per-file gate.
use schemars::JsonSchema;
use serde::Deserialize;
/// Input for tools that operate on a single routine by ID.
#[derive(Deserialize, JsonSchema)]
pub(super) struct IdInput {
/// UUID of the target routine.
pub(super) id: String,
}
/// Input for the `list_routines` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct ListRoutinesParam {
/// When `true` (the default), only return routines targeting the current machine.
/// Pass `false` to see routines from all machines.
pub(super) local_only: Option<bool>,
/// When `true`, include each routine's `prompt` in the response. Defaults to `false` so listings stay compact; use `get_routine` to see a single routine's prompt.
pub(super) include_prompts: Option<bool>,
}
/// Input for the `lock_routines` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct LockRoutinesInput {
/// Which sentinel to create: `"shared"` (committed `.lock`) or `"local"` (gitignored `.local.lock`).
pub(super) scope: String,
}
/// Input for the `unlock_routines` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct UnlockRoutinesInput {
/// Which sentinel(s) to remove: `"shared"`, `"local"`, or `"all"` (both).
pub(super) scope: String,
}
/// Input for the `create_flag` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct CreateFlagInput {
/// UUID of the routine to flag.
pub(super) id: String,
/// Free-text flag category. Common examples: "bug", "gap", `edge_case`, "question", "blocker"
/// — any string is accepted.
pub(super) r#type: String,
/// Free-text description of what's unclear.
pub(super) description: String,
/// `"general"` (committed, shared via git) or `"local"` (gitignored, machine-local).
pub(super) scope: String,
}
/// Input for the `resolve_flag` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct ResolveFlagInput {
/// UUID of the flagged routine.
pub(super) id: String,
/// Flag filename, as returned by `create_flag`/`list_flags`.
pub(super) filename: String,
}
/// Input for the `snooze_routine` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct SnoozeRoutineInput {
/// UUID of the routine to snooze.
pub(super) id: String,
/// Unix timestamp (seconds) to skip scheduled fires until, or omit/null. Mutually exclusive
/// with `skip_runs`.
pub(super) snoozed_until: Option<u64>,
/// Number of upcoming scheduled fires to skip, or omit/null. Mutually exclusive with
/// `snoozed_until`.
pub(super) skip_runs: Option<u32>,
}
/// Input for the `set_power_saving` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct SetPowerSavingInput {
/// UUID of the routine to update.
pub(super) id: String,
/// `true` to pause scheduled and manual firing for power saving, `false` to resume.
pub(super) active: bool,
}
/// Input for the `move_routine` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct MoveRoutineInput {
/// UUID of the routine to move.
pub(super) id: String,
/// New parent folder relative to `routines/`; omit or pass blank for the root.
pub(super) folder: Option<String>,
/// New routine directory name inside `folder`.
pub(super) slug: String,
}
/// Input for the `update_routine` MCP tool.
#[derive(Deserialize, JsonSchema)]
pub(super) struct UpdateRoutineInput {
/// UUID of the routine to update.
pub(super) id: String,
/// New primary cron expression, or `None` to keep the existing value. Evaluated in the
/// host's local system timezone (the OS crontab timezone), not UTC.
pub(super) schedule: Option<String>,
/// Replace all cron expressions. When provided, the first entry becomes `schedule`.
pub(super) schedules: Option<Vec<String>>,
/// New title, or `None` to keep the existing value.
pub(super) title: Option<String>,
/// New agent key, or `None` to keep the existing value.
pub(super) agent: Option<String>,
/// New model ID, or `None` to keep the existing value. A blank/whitespace-only value clears
/// the model back to the agent's own default.
pub(super) model: Option<String>,
/// New prompt, or `None` to keep the existing value.
pub(super) prompt: Option<String>,
/// New goal (a very short, ≤5-line statement of the routine's purpose), or `None` to keep the
/// existing value. Send an empty string to clear it.
pub(super) goal: Option<String>,
/// New repositories list, or `None` to keep the existing value.
pub(super) repositories: Option<Vec<crate::routines::Repository>>,
/// New machines targeting list, or `None` to keep the existing value.
pub(super) machines: Option<Vec<String>>,
/// New enabled state, or `None` to keep the existing value.
pub(super) enabled: Option<bool>,
/// New workbench TTL (seconds) for finished runs, or `None` to keep the existing value. Must
/// be greater than zero when set; `0` is rejected (#233).
pub(super) ttl_secs: Option<u64>,
/// New max runtime (seconds) for a single run before the watchdog kills it, or `None` to keep
/// the existing value. Must be greater than zero when set; `0` is rejected (#233).
pub(super) max_runtime_secs: Option<u64>,
/// New failure-circuit-breaker threshold, or `None` to keep the existing value. `Some(0)`
/// explicitly opts back out (#521); unlike `ttl_secs`/`max_runtime_secs`, `0` is accepted here.
pub(super) failure_threshold: Option<u32>,
/// New system power-saving exemption flag, or `None` to keep the existing value.
pub(super) power_saving_exempt: Option<bool>,
/// New tags list, or `None` to keep the existing value.
pub(super) tags: Option<Vec<String>>,
/// New tracked `[env]` map (replaces the whole map), or `None` to keep the existing value.
/// Non-secret only — keys must match `[A-Za-z_][A-Za-z0-9_]*` and values must not contain
/// newlines. For secrets, edit the gitignored `routine.local.toml` sidecar on disk instead.
pub(super) env: Option<std::collections::HashMap<String, String>>,
}