MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / expect_string

Function expect_string

claw-code/rust/crates/runtime/src/config.rs:659–668  ·  view source on GitHub ↗
(
    object: &'a BTreeMap<String, JsonValue>,
    key: &str,
    context: &str,
)

Source from the content-addressed store, hash-verified

657}
658
659fn expect_string<'a>(
660 object: &'a BTreeMap<String, JsonValue>,
661 key: &str,
662 context: &str,
663) -> Result<&'a str, ConfigError> {
664 object
665 .get(key)
666 .and_then(JsonValue::as_str)
667 .ok_or_else(|| ConfigError::Parse(format!("{context}: missing string field {key}")))
668}
669
670fn optional_string<'a>(
671 object: &'a BTreeMap<String, JsonValue>,

Callers 3

parse_mcp_server_configFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected