MCP: add the autosave _meta without IndexMut (#280 follow-up)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-09 00:04:47 -04:00
parent 11848da0a1
commit 459c8987fe
1 changed files with 7 additions and 2 deletions

View File

@ -161,8 +161,13 @@ impl McpServer {
content.push(json!({"type": "text", "text": format!("Warning: {e}. Use save_project with a writable path before disconnecting.")}));
}
}
if self.autosave.is_some() {
result["_meta"]["effectcraftAutoSave"] = self.autosave_info();
if self.autosave.is_some()
&& let Some(obj) = result.as_object_mut()
{
let meta = obj.entry("_meta").or_insert_with(|| json!({}));
if let Some(meta) = meta.as_object_mut() {
meta.insert("effectcraftAutoSave".into(), self.autosave_info());
}
}
if self.autosave.is_some()
&& name == "get_project"