From d9613e29cb6027e95c0c78596076cea8cbff87d0 Mon Sep 17 00:00:00 2001 From: jonaswre Date: Mon, 12 Oct 2026 14:39:42 +0200 Subject: [PATCH] test: reproduce #269 (MCP list_commands filter also matches parameter docs) --- crates/mcp/src/tests.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index 64aa12f8..f926b433 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -363,3 +363,13 @@ fn base64_matches_rfc4648() { assert_eq!(base64(i.as_bytes()), o); } } + +/// Filtering by a command id returns that command, not every command whose docs mention it (#269). +#[test] +fn list_commands_filter_by_a_command_id_matches_ids() { + let mut s = server(); + let cmds = tool(&mut s, "list_commands", json!({"filter": "sketch.delete"})); + let ids: Vec<&str> = cmds.as_array().unwrap().iter().filter_map(|c| c["id"].as_str()).collect(); + assert!(ids.contains(&"sketch.delete"), "{ids:?}"); + assert!(ids.iter().all(|id| id.contains("sketch.delete")), "{} commands matched: {ids:?}", ids.len()); +}