The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
fix(mcp): include caching hints on server/discover and tools/list results (#463)
Kevin-Christian Giraldo-Barbosa9f465da4a4f4
diff --git a/src/crates/concat-mcp/src/protocol.rs b/src/crates/concat-mcp/src/protocol.rsindex f1c0a632..210c220f 100644--- a/src/crates/concat-mcp/src/protocol.rs+++ b/src/crates/concat-mcp/src/protocol.rs@@ -251,6 +251,17 @@ fn success(id: &Value, mut result: Value, params: &Value) -> Value {json!({ "jsonrpc": "2.0", "id": id, "result": result })}+/// The caching hints 2026-07-28 requires on these results.+fn cacheable(mut reply: Value) -> Value {+ if let Some(result) = reply.get_mut("result").and_then(Value::as_object_mut)+ && result.get("resultType") == Some(&json!("complete"))+ {+ result.insert("ttlMs".to_owned(), json!(0));+ result.insert("cacheScope".to_owned(), json!("public"));+ }+ reply+}+fn failure(id: Value, code: i64, message: &str, data: Option<Value>) -> Value {let mut error = json!({ "code": code, "message": message });if let Some(data) = data {@@ -361,9 +372,9 @@ impl Server {result["_meta"] = Value::Object(meta);let mut reply = success(id, result, params);reply["result"]["resultType"] = json!("complete");- reply+ cacheable(reply)}- "tools/list" => success(id, json!({ "tools": self.toolbox.list() }), params),+ "tools/list" => cacheable(success(id, json!({ "tools": self.toolbox.list() }), params)),"tools/call" => self.call(id, params, backend, cancelled),_ => failure(id.clone(),diff --git a/src/crates/concat-mcp/tests/e2e.rs b/src/crates/concat-mcp/tests/e2e.rsindex 7d769b8c..dcca7770 100644--- a/src/crates/concat-mcp/tests/e2e.rs+++ b/src/crates/concat-mcp/tests/e2e.rs@@ -323,6 +323,8 @@ fn a_modern_client_discovers_and_is_told_which_versions_are_spoken() {let (_, discovered) = agent.ask("server/discover", json!({ "_meta": meta("2026-07-28") }));let result = &discovered["result"];assert_eq!(result["resultType"], "complete");+ assert_eq!(result["ttlMs"], 0);+ assert_eq!(result["cacheScope"], "public");assert!(result["supportedVersions"].as_array()@@ -335,6 +337,8 @@ fn a_modern_client_discovers_and_is_told_which_versions_are_spoken() {let (_, listed) = agent.ask("tools/list", json!({ "_meta": meta("2026-07-28") }));assert_eq!(listed["result"]["resultType"], "complete");+ assert_eq!(listed["result"]["ttlMs"], 0);+ assert_eq!(listed["result"]["cacheScope"], "public");assert!(listed["result"]["tools"].as_array()