Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(registry): extract resolve_env_for_transport_with_args

Steven Enamakel9a3e54cb074b
diff --git a/src/openhuman/mcp/registry/custom/ops.rs b/src/openhuman/mcp/registry/custom/ops.rs
index a1531b2b82..e45e6d0eea 100644
--- a/src/openhuman/mcp/registry/custom/ops.rs
+++ b/src/openhuman/mcp/registry/custom/ops.rs
@@ -17,7 +17,7 @@ use crate::rpc::RpcOutcome;
use super::validate::{
base_slug, build_custom_transport, clean_description, credential_scope, env_key_list,
- resolve_env, resolve_env_for_transport, validate_env,
+ resolve_env, resolve_env_for_transport_with_args, validate_env,
};
use super::{CustomServerInput, CUSTOM_QUALIFIED_PREFIX, MAX_SLUG_ATTEMPTS};
@@ -196,7 +196,7 @@ pub async fn mcp_clients_update_custom(
Some(&current.command),
Some(&current.args),
) != credential_scope(&transport, Some(&command), Some(&args));
- let env = resolve_env_for_transport(
+ let env = resolve_env_for_transport_with_args(
&input.env,
&stored_env.into_iter().collect::<HashMap<String, String>>(),
&current.transport,
diff --git a/src/openhuman/mcp/registry/custom/validate.rs b/src/openhuman/mcp/registry/custom/validate.rs
index b90afbd9da..78b50d7f27 100644
--- a/src/openhuman/mcp/registry/custom/validate.rs
+++ b/src/openhuman/mcp/registry/custom/validate.rs
@@ -244,6 +244,26 @@ pub(super) fn resolve_env_for_transport(
next: &Transport,
previous_command: Option<&str>,
next_command: Option<&str>,
+) -> HashMap<String, String> {
+ resolve_env_for_transport_with_args(
+ submitted,
+ stored,
+ previous,
+ next,
+ previous_command,
+ next_command,
+ None,
+ None,
+ )
+}
+
+pub(super) fn resolve_env_for_transport_with_args(
+ submitted: &HashMap<String, String>,
+ stored: &HashMap<String, String>,
+ previous: &Transport,
+ next: &Transport,
+ previous_command: Option<&str>,
+ next_command: Option<&str>,
previous_args: Option<&[String]>,
next_args: Option<&[String]>,
) -> HashMap<String, String> {
diff --git a/src/openhuman/mcp/registry/store_tests.rs b/src/openhuman/mcp/registry/store_tests.rs
index f7a458bb6d..4a4e9eafeb 100644
--- a/src/openhuman/mcp/registry/store_tests.rs
+++ b/src/openhuman/mcp/registry/store_tests.rs
@@ -1,3 +1,4 @@
+use super::*;
fn open_test_conn() -> (NamedTempFile, Connection) {
let f = NamedTempFile::new().unwrap();
@@ -574,4 +575,3 @@
);
}
}
-use super::*;