diff --git a/crates/op-host-services/src/mcp_serve.rs b/crates/op-host-services/src/mcp_serve.rs index cdfa70087..9bb34263e 100644 --- a/crates/op-host-services/src/mcp_serve.rs +++ b/crates/op-host-services/src/mcp_serve.rs @@ -15,6 +15,7 @@ use std::io::{BufRead, BufReader, BufWriter, Write}; use std::path::{Path, PathBuf}; use op_editor_core::{EditorCommand, EditorState}; +use op_mcp::import_html_tool::import_html_snapshot; use op_mcp::{ add_node_effect_snapshot, add_page_snapshot, align_selected_snapshot, apply_design_system_snapshot, batch_design_snapshot, batch_get_snapshot, @@ -587,6 +588,7 @@ fn rebuild_registry(doc: &EditorState, requested_tool: Option<&str>) -> ToolRegi register_tool!("set_active_axis_value", set_active_axis_value_snapshot(doc)); register_tool!("insert_node", insert_node_snapshot()); register_tool!("import_svg", import_svg_snapshot()); + register_tool!("import_html", import_html_snapshot()); register_tool!("update_node", update_node_snapshot()); register_tool!("delete_node", delete_node_snapshot()); register_tool!("move_node", move_node_snapshot()); diff --git a/crates/op-host-services/src/mcp_serve/schemas.rs b/crates/op-host-services/src/mcp_serve/schemas.rs index 9224e95f5..eab7b68b1 100644 --- a/crates/op-host-services/src/mcp_serve/schemas.rs +++ b/crates/op-host-services/src/mcp_serve/schemas.rs @@ -120,6 +120,7 @@ pub const TOOL_SCHEMAS: &[&str] = &[ r#"{"name":"insert_node","description":"Create a new leaf node on the active or requested page. Accepts Rust flat fields or TS-style data object.","inputSchema":{"type":"object","properties":{"filePath":{"type":"string","description":"Optional target .op file path; omit to use the server document"},"kind":{"type":"string","enum":["frame","group","rect","ellipse","polygon","line","text","path"]},"name":{"type":"string"},"x":{"type":"string"},"y":{"type":"string"},"width":{"type":"string"},"height":{"type":"string"},"fill_hex":{"type":"string"},"parent":{"type":"string","description":"optional parent node id; empty/0/null/root omitted = page root"},"data":{"type":"object","description":"TS-style PenNode data; rich fields are preserved as a subtree"},"postProcess":{"type":"boolean","description":"Accepted for TS compatibility; Rust leaf insert path ignores post-processing"},"canvasWidth":{"type":"number","description":"Accepted for TS compatibility; Rust leaf insert path ignores post-processing width"},"pageId":{"type":"string","description":"optional target page id or legacy page index; omitted = active page"}}}}"#, r#"{"name":"update_node","description":"Patch fields on an existing node. Accepts Rust flat fields or TS-style nodeId + data object.","inputSchema":{"type":"object","properties":{"filePath":{"type":"string","description":"Optional target .op file path; omit to use the server document"},"node_id":{"type":"string"},"nodeId":{"type":"string"},"x":{"type":"string"},"y":{"type":"string"},"width":{"type":"string"},"height":{"type":"string"},"name":{"type":"string"},"fill_hex":{"type":"string"},"data":{"type":"object","description":"TS-style shallow patch data; rich fields such as content/fontSize are preserved"},"postProcess":{"type":"boolean","description":"Accepted for TS compatibility; Rust patch path ignores post-processing"},"canvasWidth":{"type":"number","description":"Accepted for TS compatibility; Rust patch path ignores post-processing width"},"pageId":{"type":"string","description":"optional target page id or legacy page index; omitted = active page"}}}}"#, r#"{"name":"import_svg","description":"Parse an SVG document and insert the resulting nodes on the active or requested page. Accepts inline svg or TS-style svgPath. Supports rect/circle/ellipse/line/polyline/polygon and path (M/L/H/V/C/S/Q/T/Z).","inputSchema":{"type":"object","properties":{"filePath":{"type":"string","description":"Optional target .op file path; omit to use the server document"},"svg":{"type":"string","description":"SVG document text"},"svgPath":{"type":"string","description":"local SVG file path"},"x":{"type":"string","description":"i32 doc-px x offset (default 0)"},"y":{"type":"string","description":"i32 doc-px y offset (default 0)"},"parent":{"type":"string","description":"optional parent node id; empty/0/root omitted = page root"},"maxDim":{"type":"number","description":"Accepted for TS compatibility; Rust SVG path currently preserves parsed dimensions"},"postProcess":{"type":"boolean","description":"Accepted for TS compatibility; Rust SVG path ignores post-processing"},"canvasWidth":{"type":"number","description":"Accepted for TS compatibility; Rust SVG path ignores post-processing width"},"pageId":{"type":"string","description":"optional target page id or legacy page index; omitted = active page"}}}}"#, + r#"{"name":"import_html","description":"Parse an HTML document or snippet (CSS-subset cascade: inline style,