Build one nested params path from a flat key. Collisions such as `a` and `a.b` cannot round-trip as nested YAML, so callers fall back to the flat map.
(
root: &mut BTreeMap<String, ParamMatcherDef>,
key: &str,
matcher: ParamMatcherDef,
)
| 455 | // Build one nested params path from a flat key. Collisions such as `a` and |
| 456 | // `a.b` cannot round-trip as nested YAML, so callers fall back to the flat map. |
| 457 | fn insert_nested_param( |
| 458 | root: &mut BTreeMap<String, ParamMatcherDef>, |
| 459 | key: &str, |
| 460 | matcher: ParamMatcherDef, |
| 461 | ) -> Result<(), ()> { |
| 462 | let mut parts = key.split('.').peekable(); |
| 463 | let Some(first) = parts.next() else { |
| 464 | return Err(()); |
| 465 | }; |
| 466 | |
| 467 | if parts.peek().is_none() { |
| 468 | root.insert(first.to_string(), matcher); |
| 469 | return Ok(()); |
| 470 | } |
| 471 | |
| 472 | let child = root |
| 473 | .entry(first.to_string()) |
| 474 | .or_insert_with(|| ParamMatcherDef::Object(BTreeMap::new())); |
| 475 | let ParamMatcherDef::Object(children) = child else { |
| 476 | return Err(()); |
| 477 | }; |
| 478 | let remainder = parts.collect::<Vec<_>>().join("."); |
| 479 | insert_nested_param(children, &remainder, matcher) |
| 480 | } |
| 481 | |
| 482 | // MCP `tool` is a policy convenience for the standard `tools/call` params.name |
| 483 | // field. When the endpoint method profile is enabled, authored tool selectors |
no test coverage detected