Skip to main content
Glama
list_parameters.rs1.29 kB
use axum::extract::{ Path, State, }; use innit_core::{ ListParametersResponse, Parameter, }; use telemetry::tracing::info; use super::AppError; use crate::{ app_state::AppState, routes::Json, }; pub async fn list_parameters_route( Path(path): Path<String>, State(AppState { parameter_cache, parameter_store_client, .. }): State<AppState>, ) -> Result<Json<ListParametersResponse>, AppError> { let path = if !path.starts_with('/') { format!("/{path}") } else { path }; if let Some(parameters) = parameter_cache.get_parameters_by_path(&path).await { info!("Fetched parameter from cache at path: {path}"); return Ok(Json(ListParametersResponse { parameters, is_cached: true, })); } let parameters: Vec<Parameter> = parameter_store_client .parameters_by_path(path.clone()) .await? .iter() .cloned() .map(Parameter::from) .collect(); parameter_cache .set_parameters_by_path(path.clone(), parameters.clone()) .await; info!("Fetched parameter from ParameterStore at path: {path}"); Ok(Json(ListParametersResponse { parameters, is_cached: false, })) }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server