MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / unknown_key_error

Function unknown_key_error

src/tool_command/args.rs:364–392  ·  view source on GitHub ↗
(
    key: &str,
    short: &str,
    props: &Map<String, Value>,
    required: &[String],
)

Source from the content-addressed store, hash-verified

362}
363
364fn unknown_key_error(
365 key: &str,
366 short: &str,
367 props: &Map<String, Value>,
368 required: &[String],
369) -> TraceDecayError {
370 let suggestion = nearest_key(key, props)
371 .map(|k| format!(" — did you mean `--{}`?", k.replace('_', "-")))
372 .unwrap_or_default();
373 let mut valid: Vec<String> = props
374 .keys()
375 .map(|k| {
376 let flag = format!("--{}", k.replace('_', "-"));
377 if required.contains(k) {
378 format!("{flag} (required)")
379 } else {
380 flag
381 }
382 })
383 .collect();
384 valid.sort();
385 TraceDecayError::Config {
386 message: format!(
387 "unknown parameter `--{}` for `{short}`{suggestion} Valid: {}",
388 key.replace('_', "-"),
389 valid.join(", ")
390 ),
391 }
392}
393
394/// True when a JSON value is acceptable for a schema `type` string. `number`
395/// accepts integers; `integer` requires a whole number. Unknown schema types

Callers 1

validate_tool_argsFunction · 0.85

Calls 3

nearest_keyFunction · 0.85
collectMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected