MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / complete_provider_names

Function complete_provider_names

crates/openshell-cli/src/completers.rs:57–77  ·  view source on GitHub ↗

Complete provider names by querying the active gateway.

(_prefix: &OsStr)

Source from the content-addressed store, hash-verified

55
56/// Complete provider names by querying the active gateway.
57pub fn complete_provider_names(_prefix: &OsStr) -> Vec<CompletionCandidate> {
58 blocking_complete(async {
59 let (endpoint, gateway_name) = resolve_active_gateway()?;
60 let mut client = completion_grpc_client(&endpoint, &gateway_name).await?;
61 let response = client
62 .list_providers(ListProvidersRequest {
63 limit: 200,
64 offset: 0,
65 })
66 .await
67 .ok()?;
68 Some(
69 response
70 .into_inner()
71 .providers
72 .into_iter()
73 .map(|p| CompletionCandidate::new(p.object_name()))
74 .collect(),
75 )
76 })
77}
78
79fn resolve_active_gateway() -> Option<(String, String)> {
80 let name = std::env::var("OPENSHELL_GATEWAY")

Calls 5

blocking_completeFunction · 0.85
resolve_active_gatewayFunction · 0.85
completion_grpc_clientFunction · 0.85
object_nameMethod · 0.80
list_providersMethod · 0.45