wire gap_filler into schedule engine, API, MCP
This commit is contained in:
@@ -47,6 +47,7 @@ pub struct UpdateChannelParams {
|
||||
pub timezone: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub schedule_config_json: Option<String>,
|
||||
pub gap_filler_json: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, JsonSchema)]
|
||||
@@ -98,7 +99,7 @@ impl KTvMcpServer {
|
||||
channels::create_channel(&self.channel_cmd_deps, self.owner_id, &p.name, &p.timezone).await
|
||||
}
|
||||
|
||||
#[tool(description = "Update channel name, timezone, description, and/or schedule config")]
|
||||
#[tool(description = "Update channel name, timezone, description, schedule config, and/or gap_filler")]
|
||||
async fn update_channel(&self, #[tool(aggr)] p: UpdateChannelParams) -> String {
|
||||
let id = match parse_uuid(&p.id) {
|
||||
Ok(id) => id,
|
||||
@@ -114,6 +115,17 @@ impl KTvMcpServer {
|
||||
},
|
||||
None => None,
|
||||
};
|
||||
let gap_filler = match p.gap_filler_json {
|
||||
Some(json) if json == "null" => Some(None),
|
||||
Some(json) => match serde_json::from_str(&json) {
|
||||
Ok(f) => Some(Some(f)),
|
||||
Err(e) => {
|
||||
return serde_json::json!({"error": format!("invalid gap_filler_json: {e}")})
|
||||
.to_string()
|
||||
}
|
||||
},
|
||||
None => None,
|
||||
};
|
||||
channels::update_channel(
|
||||
&self.channel_cmd_deps,
|
||||
id,
|
||||
@@ -122,6 +134,7 @@ impl KTvMcpServer {
|
||||
p.timezone,
|
||||
p.description,
|
||||
schedule_config,
|
||||
gap_filler,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user