MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / list_agents

Function list_agents

crates/opencode-server/src/routes.rs:4395–4416  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4393}
4394
4395async fn list_agents() -> Result<Json<Vec<AgentInfo>>> {
4396 let mut config = std::env::current_dir()
4397 .ok()
4398 .and_then(|cwd| load_config(&cwd).ok());
4399
4400 if let (Some(loader), Some(config)) = (get_plugin_loader(), config.as_mut()) {
4401 apply_plugin_config_hooks(loader, config).await;
4402 }
4403
4404 let registry = AgentRegistry::from_optional_config(config.as_ref());
4405 let agents = registry
4406 .list()
4407 .into_iter()
4408 .filter(|agent| !matches!(agent.mode, AgentMode::Subagent))
4409 .map(|agent| AgentInfo {
4410 id: agent.name.clone(),
4411 name: agent.name.clone(),
4412 description: agent.description.clone(),
4413 })
4414 .collect();
4415 Ok(Json(agents))
4416}
4417
4418async fn apply_plugin_config_hooks(loader: &Arc<PluginLoader>, config: &mut AppConfig) {
4419 let mut config_value = match serde_json::to_value(config.clone()) {

Callers

nothing calls this directly

Calls 6

load_configFunction · 0.85
get_plugin_loaderFunction · 0.85
filterMethod · 0.45
listMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected