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

Method parse_json

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

Source from the content-addressed store, hash-verified

30 }
31
32 fn parse_json(&self, hook_type: HookType, input: &[u8]) -> AgentResult<Value> {
33 if input.is_empty() {
34 return Err(AgentError::HookInputEmpty {
35 agent: self.name().to_string(),
36 hook_type: hook_type.as_str().to_string(),
37 });
38 }
39
40 serde_json::from_slice(input).map_err(|e| AgentError::HookParseFailed {
41 agent: self.name().to_string(),
42 hook_type: hook_type.as_str().to_string(),
43 reason: e.to_string(),
44 })
45 }
46
47 fn extract_session_id(raw: &Value) -> String {
48 value_string(raw, "session_id")

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