MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / parse_json

Method parse_json

atomic-agent/src/hooks/grok.rs:133–145  ·  view source on GitHub ↗
(&self, hook_type: HookType, input: &[u8])

Source from the content-addressed store, hash-verified

131 }
132
133 fn parse_json(&self, hook_type: HookType, input: &[u8]) -> AgentResult<Value> {
134 if input.is_empty() {
135 return Err(AgentError::HookInputEmpty {
136 agent: self.name().to_string(),
137 hook_type: hook_type.as_str().to_string(),
138 });
139 }
140 serde_json::from_slice(input).map_err(|e| AgentError::HookParseFailed {
141 agent: self.name().to_string(),
142 hook_type: hook_type.as_str().to_string(),
143 reason: e.to_string(),
144 })
145 }
146
147 fn parse_common(&self, hook_type: HookType, raw: Value) -> AgentResult<CommonInput> {
148 serde_json::from_value(raw).map_err(|e| AgentError::HookParseFailed {

Callers 1

parse_eventMethod · 0.45

Calls 3

is_emptyMethod · 0.45
nameMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected