swarm repositories / source
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock120
-rw-r--r--Cargo.toml3
-rw-r--r--crates/adequate-rust-mcp/Cargo.toml1
-rw-r--r--crates/adequate-rust-mcp/src/worker/schema.rs6
-rw-r--r--crates/adequate-rust-mcp/src/worker/tests.rs49
-rw-r--r--crates/adequate-rust-mcp/tests/diagnostics_warmup_retry.rs1
-rw-r--r--crates/adequate-rust-mcp/tests/e2e_gauntlet.rs1
-rw-r--r--crates/adequate-rust-mcp/tests/host_inflight_replay.rs1
-rw-r--r--crates/adequate-rust-mcp/tests/worktree_workspace_rebind.rs1
9 files changed, 126 insertions, 57 deletions
diff --git a/Cargo.lock b/Cargo.lock
index fcd9cbe..5eaeff4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7,6 +7,7 @@ name = "adequate-rust-mcp"
version = "1.0.0"
dependencies = [
"libmcp",
+ "libmcp-testkit",
"notify",
"ra-mcp-domain",
"ra-mcp-engine",
@@ -102,9 +103,9 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
[[package]]
name = "cc"
-version = "1.2.56"
+version = "1.2.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2"
+checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423"
dependencies = [
"find-msvc-tools",
"shlex",
@@ -338,9 +339,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.4.1"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
+checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
dependencies = [
"cfg-if",
"libc",
@@ -522,9 +523,9 @@ dependencies = [
[[package]]
name = "inotify"
-version = "0.11.0"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3"
+checksum = "bd5b3eaf1a28b758ac0faa5a4254e8ab2705605496f1b1f3fbbc3988ad73d199"
dependencies = [
"bitflags 2.11.0",
"inotify-sys",
@@ -542,15 +543,15 @@ dependencies = [
[[package]]
name = "itoa"
-version = "1.0.17"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "js-sys"
-version = "0.3.90"
+version = "0.3.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14dc6f6450b3f6d4ed5b16327f38fed626d375a886159ca555bd7822c0c3a5a6"
+checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c"
dependencies = [
"once_cell",
"wasm-bindgen",
@@ -590,15 +591,16 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "libc"
-version = "0.2.182"
+version = "0.2.183"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
+checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
[[package]]
name = "libmcp"
version = "1.1.0"
-source = "git+https://git.swarm.moe/libmcp.git?rev=84e898d9ba699451d5d13fe384e7bbe220564bc1#84e898d9ba699451d5d13fe384e7bbe220564bc1"
+source = "git+https://git.swarm.moe/libmcp.git?rev=bb92a05eb5446e07c6288e266bd06d7b5899eee5#bb92a05eb5446e07c6288e266bd06d7b5899eee5"
dependencies = [
+ "libmcp-derive",
"schemars",
"serde",
"serde_json",
@@ -608,6 +610,26 @@ dependencies = [
]
[[package]]
+name = "libmcp-derive"
+version = "1.1.0"
+source = "git+https://git.swarm.moe/libmcp.git?rev=bb92a05eb5446e07c6288e266bd06d7b5899eee5#bb92a05eb5446e07c6288e266bd06d7b5899eee5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "libmcp-testkit"
+version = "1.1.0"
+source = "git+https://git.swarm.moe/libmcp.git?rev=bb92a05eb5446e07c6288e266bd06d7b5899eee5#bb92a05eb5446e07c6288e266bd06d7b5899eee5"
+dependencies = [
+ "libmcp",
+ "serde",
+ "serde_json",
+]
+
+[[package]]
name = "linux-raw-sys"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -721,9 +743,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.21.3"
+version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "parking_lot"
@@ -762,9 +784,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "pin-project-lite"
-version = "0.2.16"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "potential_utf"
@@ -796,18 +818,18 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.44"
+version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
dependencies = [
"proc-macro2",
]
[[package]]
name = "r-efi"
-version = "5.3.0"
+version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]]
name = "ra-mcp-domain"
@@ -1135,12 +1157,12 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "socket2"
-version = "0.6.2"
+version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0"
+checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
dependencies = [
"libc",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1179,9 +1201,9 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.26.0"
+version = "3.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom",
@@ -1231,9 +1253,9 @@ dependencies = [
[[package]]
name = "tokio"
-version = "1.49.0"
+version = "1.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86"
+checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d"
dependencies = [
"bytes",
"libc",
@@ -1248,9 +1270,9 @@ dependencies = [
[[package]]
name = "tokio-macros"
-version = "2.6.0"
+version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
+checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c"
dependencies = [
"proc-macro2",
"quote",
@@ -1356,9 +1378,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.22"
+version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
+checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
dependencies = [
"matchers",
"nu-ansi-term",
@@ -1426,11 +1448,11 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "wasip2"
-version = "1.0.1+wasi-0.2.4"
+version = "1.0.2+wasi-0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
+checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
dependencies = [
- "wit-bindgen 0.46.0",
+ "wit-bindgen",
]
[[package]]
@@ -1439,14 +1461,14 @@ version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
dependencies = [
- "wit-bindgen 0.51.0",
+ "wit-bindgen",
]
[[package]]
name = "wasm-bindgen"
-version = "0.2.113"
+version = "0.2.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60722a937f594b7fde9adb894d7c092fc1bb6612897c46368d18e7a20208eff2"
+checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e"
dependencies = [
"cfg-if",
"once_cell",
@@ -1457,9 +1479,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.113"
+version = "0.2.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fac8c6395094b6b91c4af293f4c79371c163f9a6f56184d2c9a85f5a95f3950"
+checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -1467,9 +1489,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.113"
+version = "0.2.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab3fabce6159dc20728033842636887e4877688ae94382766e00b180abac9d60"
+checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -1480,9 +1502,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.113"
+version = "0.2.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de0e091bdb824da87dc01d967388880d017a0a9bc4f3bdc0d86ee9f9336e3bb5"
+checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16"
dependencies = [
"unicode-ident",
]
@@ -1674,21 +1696,15 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
[[package]]
name = "winnow"
-version = "0.7.14"
+version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
dependencies = [
"memchr",
]
[[package]]
name = "wit-bindgen"
-version = "0.46.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
-
-[[package]]
-name = "wit-bindgen"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
diff --git a/Cargo.toml b/Cargo.toml
index ed0217b..eab7a70 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,8 @@ version = "1.0.0"
assert_matches = "1.5.0"
bytes = "1.10.1"
futures = "0.3.31"
-libmcp = { git = "https://git.swarm.moe/libmcp.git", rev = "84e898d9ba699451d5d13fe384e7bbe220564bc1" }
+libmcp = { git = "https://git.swarm.moe/libmcp.git", rev = "bb92a05eb5446e07c6288e266bd06d7b5899eee5" }
+libmcp-testkit = { git = "https://git.swarm.moe/libmcp.git", rev = "bb92a05eb5446e07c6288e266bd06d7b5899eee5", package = "libmcp-testkit" }
lsp-types = "0.97.0"
notify = "8.2.0"
rmcp = { version = "0.16.0", features = ["server", "macros", "transport-io"] }
diff --git a/crates/adequate-rust-mcp/Cargo.toml b/crates/adequate-rust-mcp/Cargo.toml
index 9702887..5b12c3d 100644
--- a/crates/adequate-rust-mcp/Cargo.toml
+++ b/crates/adequate-rust-mcp/Cargo.toml
@@ -26,6 +26,7 @@ tracing-subscriber.workspace = true
url.workspace = true
[dev-dependencies]
+libmcp-testkit.workspace = true
serial_test.workspace = true
tempfile.workspace = true
diff --git a/crates/adequate-rust-mcp/src/worker/schema.rs b/crates/adequate-rust-mcp/src/worker/schema.rs
index 7ea8067..345060c 100644
--- a/crates/adequate-rust-mcp/src/worker/schema.rs
+++ b/crates/adequate-rust-mcp/src/worker/schema.rs
@@ -390,7 +390,8 @@ pub(super) struct FixStepOutput {
pub(super) standard_error_excerpt: Option<String>,
}
-#[derive(Debug, Clone, Serialize, JsonSchema)]
+#[derive(Debug, Clone, Serialize, JsonSchema, libmcp::ToolProjection)]
+#[libmcp(kind = "ops")]
pub(super) struct HealthOutput {
pub(super) state: HealthStateOutput,
pub(super) generation: u64,
@@ -413,7 +414,8 @@ pub(super) struct FaultOutput {
pub(super) detail: String,
}
-#[derive(Debug, Clone, Serialize, JsonSchema)]
+#[derive(Debug, Clone, Serialize, JsonSchema, libmcp::ToolProjection)]
+#[libmcp(kind = "ops")]
pub(super) struct TelemetryOutput {
pub(super) uptime_ms: u64,
pub(super) state: HealthStateOutput,
diff --git a/crates/adequate-rust-mcp/src/worker/tests.rs b/crates/adequate-rust-mcp/src/worker/tests.rs
index ee9e22c..fc821a7 100644
--- a/crates/adequate-rust-mcp/src/worker/tests.rs
+++ b/crates/adequate-rust-mcp/src/worker/tests.rs
@@ -1,11 +1,13 @@
use super::{
AbsolutePathInput, AdvancedLspMethod, AdvancedLspRequestInput, CommonRenderConfig,
CommonRenderInput, DiagnosticsInput, DiagnosticsJsonOutput, DiagnosticsModeInput,
- DiagnosticsPathStyleInput, DiagnosticsRenderConfig, DiagnosticsRenderInput, HoverPayload,
- OneIndexedInput, PathStyleInput, SnapshotRenderInput, SymbolQueryInput,
+ DiagnosticsPathStyleInput, DiagnosticsRenderConfig, DiagnosticsRenderInput, FaultOutput,
+ HealthOutput, HealthStateOutput, HoverPayload, MethodTelemetryOutput, OneIndexedInput,
+ PathStyleInput, SnapshotRenderInput, SymbolQueryInput, TelemetryOutput, TelemetryTotalsOutput,
parse_clippy_json_stream, read_workspace_tool_command, read_workspace_tool_metadata,
render_definition_porcelain, render_hover_porcelain, resolve_workspace_fix_command_specs,
};
+use libmcp_testkit::assert_projection_doctrine;
use ra_mcp_domain::types::{
OneIndexedColumn, OneIndexedLine, SourceFilePath, SourcePoint, SourceRange,
};
@@ -232,6 +234,49 @@ fn diagnostics_input_defaults_to_compact_porcelain_absolute_without_limits() {
}
#[test]
+fn ops_outputs_obey_projection_doctrine() {
+ let health = HealthOutput {
+ state: HealthStateOutput::Ready,
+ generation: 7,
+ last_fault: Some(FaultOutput {
+ class: "transport".to_owned(),
+ code: "worker_crash".to_owned(),
+ detail: "worker died during replay".to_owned(),
+ }),
+ };
+ assert!(assert_projection_doctrine(&health).is_ok());
+
+ let telemetry = TelemetryOutput {
+ uptime_ms: 12_345,
+ state: HealthStateOutput::Recovering,
+ generation: 9,
+ consecutive_failures: 2,
+ restart_count: 4,
+ totals: TelemetryTotalsOutput {
+ request_count: 17,
+ success_count: 13,
+ response_error_count: 1,
+ transport_fault_count: 2,
+ retry_count: 3,
+ },
+ methods: vec![MethodTelemetryOutput {
+ method: "tools/call:diagnostics".to_owned(),
+ request_count: 8,
+ success_count: 6,
+ response_error_count: 1,
+ transport_fault_count: 1,
+ retry_count: 2,
+ last_latency_ms: Some(42),
+ max_latency_ms: 88,
+ avg_latency_ms: 51,
+ last_error: Some("index warming".to_owned()),
+ }],
+ last_fault: None,
+ };
+ assert!(assert_projection_doctrine(&telemetry).is_ok());
+}
+
+#[test]
fn diagnostics_input_rejects_legacy_format_field() {
let parsed = serde_json::from_value::<DiagnosticsInput>(json!({
"file_path": "/tmp/diagnostics_defaults.rs",
diff --git a/crates/adequate-rust-mcp/tests/diagnostics_warmup_retry.rs b/crates/adequate-rust-mcp/tests/diagnostics_warmup_retry.rs
index b27c34f..df1cc70 100644
--- a/crates/adequate-rust-mcp/tests/diagnostics_warmup_retry.rs
+++ b/crates/adequate-rust-mcp/tests/diagnostics_warmup_retry.rs
@@ -401,3 +401,4 @@ fn resolve_fake_ra_binary() -> Result<PathBuf, Box<dyn Error>> {
Ok(target_debug.join("fake-rust-analyzer"))
}
use libmcp as _;
+use libmcp_testkit as _;
diff --git a/crates/adequate-rust-mcp/tests/e2e_gauntlet.rs b/crates/adequate-rust-mcp/tests/e2e_gauntlet.rs
index a5a2861..1079064 100644
--- a/crates/adequate-rust-mcp/tests/e2e_gauntlet.rs
+++ b/crates/adequate-rust-mcp/tests/e2e_gauntlet.rs
@@ -924,3 +924,4 @@ async fn rust_analyzer_available(binary: &str) -> bool {
matches!(status, Ok(status) if status.success())
}
use libmcp as _;
+use libmcp_testkit as _;
diff --git a/crates/adequate-rust-mcp/tests/host_inflight_replay.rs b/crates/adequate-rust-mcp/tests/host_inflight_replay.rs
index 17088d6..8b3d439 100644
--- a/crates/adequate-rust-mcp/tests/host_inflight_replay.rs
+++ b/crates/adequate-rust-mcp/tests/host_inflight_replay.rs
@@ -655,3 +655,4 @@ fn read_jsonl_events(path: &Path) -> Result<Vec<Value>, Box<dyn Error>> {
Ok(events)
}
use libmcp as _;
+use libmcp_testkit as _;
diff --git a/crates/adequate-rust-mcp/tests/worktree_workspace_rebind.rs b/crates/adequate-rust-mcp/tests/worktree_workspace_rebind.rs
index ca61753..4b0329e 100644
--- a/crates/adequate-rust-mcp/tests/worktree_workspace_rebind.rs
+++ b/crates/adequate-rust-mcp/tests/worktree_workspace_rebind.rs
@@ -381,3 +381,4 @@ fn resolve_fake_ra_binary() -> Result<PathBuf, Box<dyn Error>> {
Ok(target_debug.join("fake-rust-analyzer"))
}
use libmcp as _;
+use libmcp_testkit as _;