agent_server/api/agents.rs
1//! Agent discovery route and response handling.
2
3use actix_web::{
4 HttpResponse, Responder, Scope, get,
5 web::{self, Data},
6};
7
8use super::types::AgentCatalog;
9
10#[get("")]
11async fn list_agents(catalog: Data<AgentCatalog>) -> impl Responder {
12 HttpResponse::Ok().json(catalog.list())
13}
14
15/// Builds the /agents route scope. Register AgentCatalog as application data
16/// before mounting this scope.
17pub fn agents_api() -> Scope {
18 web::scope("/agents").service(list_agents)
19}