pub struct FilterEngine { /* private fields */ }Expand description
Engine that applies the 8-stage JSON compression pipeline.
The engine holds a reference to the shared Config and resolves per-tool
filter rules on each call via Config::get_tool_rules.
§Examples
let config = Arc::new(Config::from_upstream(&["npx", "some-mcp"], None).unwrap());
let engine = FilterEngine::new(config);
let filtered = engine.filter("list_merge_requests", r#"[{"iid":1,"title":"Fix"}]"#);Implementations§
Source§impl FilterEngine
impl FilterEngine
Sourcepub fn new(config: Arc<Config>) -> Self
pub fn new(config: Arc<Config>) -> Self
Create a new filter engine with the given configuration.
Precompiles all regex transforms from defaults and per-tool rules.
Sourcepub fn filter(&self, tool_name: &str, raw: &str) -> String
pub fn filter(&self, tool_name: &str, raw: &str) -> String
Apply the full filter pipeline to a tool’s raw output string.
If raw is valid JSON, it is parsed and run through all 8 pipeline
stages. If parsing fails, only plain-text truncation is applied.
Responses exceeding 10 MB are truncated before parsing.
Auto Trait Implementations§
impl Freeze for FilterEngine
impl RefUnwindSafe for FilterEngine
impl Send for FilterEngine
impl Sync for FilterEngine
impl Unpin for FilterEngine
impl UnsafeUnpin for FilterEngine
impl UnwindSafe for FilterEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more