forked from 1b-agent/opencadstudio-upstream
feat(mcp): add text_search and text_replace with multiline MText and accent-insensitive matching
- Add text_search (read) and text_replace (mutating) operations to control bridge, automation, and MCP - Support single and batch find/replace pairs under atomic undo transactions - Safely parse and preserve MText formatting tags, inline fonts, colors, and margins - Add flexible multiline MText matching and replacement across paragraph breaks (\n <-> \P) - Add accent/diacritic-insensitive matching across Unicode and ASCII character sets - Support Windows-1252 / ISO-8859-1 code decoding (%%nnn), DXF Unicode escapes (\U+XXXX), and special character codes - Expose ignore_accents parameter across ocs_read and ocs_execute MCP tool schemas
This commit is contained in:
1 parent
ea91315ba8
commit
88169c1d7a
6 files changed
+1394
-2
No files matched your search
@@ -471,6 +471,7 @@ impl OpenCADStudio {
|
||||
| "xdata_get"
|
||||
| "get_selection"
|
||||
| "audit"
|
||||
| "text_search"
|
||||
);
|
||||
if !query && !self.control.enabled {
|
||||
return (
|
||||
@@ -729,6 +730,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
"xdata_get" => self.xdata_read(&req),
|
||||
"get_selection" => self.control_get_selection(),
|
||||
"text_search" => self.control_text_search(&req).unwrap_or_else(|e| e),
|
||||
"history" => {
|
||||
json!({"ok":true,"entries":self.command_line.history.iter().map(|e|json!({"kind":format!("{:?}",e.kind),"text":e.text})).collect::<Vec<_>>()})
|
||||
}
|
||||
@@ -975,6 +977,7 @@ impl OpenCADStudio {
|
||||
"entities_delete" => self.control_entities_delete(req)?,
|
||||
"entities_transform" => self.control_entities_transform(req)?,
|
||||
"entities_copy_to" => self.control_entities_copy_to(req)?,
|
||||
"text_replace" => self.control_text_replace(req)?,
|
||||
"xdata_set" => self.control_xdata_set(req)?,
|
||||
"block_define" => self.control_block_define(req)?,
|
||||
"block_delete" => self.control_block_delete(req)?,
|
||||
@@ -1340,6 +1343,7 @@ pub(crate) mod http_bridge;
|
||||
mod interactive;
|
||||
mod sheets;
|
||||
pub(crate) use sheets::new_guid_v4;
|
||||
pub(crate) mod text_ops;
|
||||
|
||||
#[cfg(test)]
|
||||
mod p1_tests;
|
||||
|
||||
Reference in new issue
Block a user