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

Function missing_flag_value_error

src/tool_command/args.rs:499–510  ·  view source on GitHub ↗

Corrective error for a flag with no following value, stating the exact fix (booleans get the `true`/`false` example verbatim).

(flag: &str, prop_schema: Option<&Value>)

Source from the content-addressed store, hash-verified

497/// Corrective error for a flag with no following value, stating the exact fix
498/// (booleans get the `true`/`false` example verbatim).
499fn missing_flag_value_error(flag: &str, prop_schema: Option<&Value>) -> TraceDecayError {
500 let is_boolean = prop_schema
501 .and_then(|p| p.get("type"))
502 .and_then(Value::as_str)
503 == Some("boolean");
504 let message = if is_boolean {
505 format!("flag `{flag}` requires a value — pass `{flag} true` or `{flag} false`")
506 } else {
507 format!("flag `{flag}` requires a value — write `{flag} <value>` or `{flag}=<value>`")
508 };
509 TraceDecayError::Config { message }
510}
511
512fn bind_positionals(
513 def: &ToolDefinition,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected